Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: test/Prefs.cpp

Issue 29367003: Issue #4711 - Rewrite legacy thread facilities
Patch Set: Created Dec. 7, 2016, 4:44 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 TEST_F(PrefsTest, PrefsPersist) 115 TEST_F(PrefsTest, PrefsPersist)
116 { 116 {
117 ASSERT_EQ("patterns.ini", filterEngine->GetPref("patternsfile")->AsString()); 117 ASSERT_EQ("patterns.ini", filterEngine->GetPref("patternsfile")->AsString());
118 ASSERT_EQ(24, filterEngine->GetPref("patternsbackupinterval")->AsInt()); 118 ASSERT_EQ(24, filterEngine->GetPref("patternsbackupinterval")->AsInt());
119 ASSERT_TRUE(filterEngine->GetPref("subscriptions_autoupdate")->AsBool()); 119 ASSERT_TRUE(filterEngine->GetPref("subscriptions_autoupdate")->AsBool());
120 120
121 filterEngine->SetPref("patternsfile", jsEngine->NewValue("filters.ini")); 121 filterEngine->SetPref("patternsfile", jsEngine->NewValue("filters.ini"));
122 filterEngine->SetPref("patternsbackupinterval", jsEngine->NewValue(48)); 122 filterEngine->SetPref("patternsbackupinterval", jsEngine->NewValue(48));
123 filterEngine->SetPref("subscriptions_autoupdate", jsEngine->NewValue(false)); 123 filterEngine->SetPref("subscriptions_autoupdate", jsEngine->NewValue(false));
124 124
125 AdblockPlus::Sleep(100); 125 std::this_thread::sleep_for(std::chrono::milliseconds(100));
126 126
127 ASSERT_FALSE(fileSystem->prefsContents.empty()); 127 ASSERT_FALSE(fileSystem->prefsContents.empty());
128 128
129 Reset(); 129 Reset();
130 130
131 ASSERT_EQ("filters.ini", filterEngine->GetPref("patternsfile")->AsString()); 131 ASSERT_EQ("filters.ini", filterEngine->GetPref("patternsfile")->AsString());
132 ASSERT_EQ(48, filterEngine->GetPref("patternsbackupinterval")->AsInt()); 132 ASSERT_EQ(48, filterEngine->GetPref("patternsbackupinterval")->AsInt());
133 ASSERT_FALSE(filterEngine->GetPref("subscriptions_autoupdate")->AsBool()); 133 ASSERT_FALSE(filterEngine->GetPref("subscriptions_autoupdate")->AsBool());
134 } 134 }
135 135
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 TEST_F(PrefsTest, PrefsPersistWhenPreconfigured) 186 TEST_F(PrefsTest, PrefsPersistWhenPreconfigured)
187 { 187 {
188 AdblockPlus::FilterEngine::Prefs preconfiguredPrefs; 188 AdblockPlus::FilterEngine::Prefs preconfiguredPrefs;
189 preconfiguredPrefs["suppress_first_run_page"] = jsEngine->NewValue(true); 189 preconfiguredPrefs["suppress_first_run_page"] = jsEngine->NewValue(true);
190 Reset(preconfiguredPrefs); 190 Reset(preconfiguredPrefs);
191 191
192 ASSERT_TRUE(filterEngine->GetPref("suppress_first_run_page")->IsBool()); 192 ASSERT_TRUE(filterEngine->GetPref("suppress_first_run_page")->IsBool());
193 ASSERT_TRUE(filterEngine->GetPref("suppress_first_run_page")->AsBool()); 193 ASSERT_TRUE(filterEngine->GetPref("suppress_first_run_page")->AsBool());
194 filterEngine->SetPref("suppress_first_run_page", jsEngine->NewValue(false)); 194 filterEngine->SetPref("suppress_first_run_page", jsEngine->NewValue(false));
195 195
196 AdblockPlus::Sleep(100); 196 std::this_thread::sleep_for(std::chrono::milliseconds(100));
197 197
198 ASSERT_FALSE(fileSystem->prefsContents.empty()); 198 ASSERT_FALSE(fileSystem->prefsContents.empty());
199 199
200 Reset(preconfiguredPrefs); 200 Reset(preconfiguredPrefs);
201 201
202 ASSERT_TRUE(filterEngine->GetPref("suppress_first_run_page")->IsBool()); 202 ASSERT_TRUE(filterEngine->GetPref("suppress_first_run_page")->IsBool());
203 ASSERT_FALSE(filterEngine->GetPref("suppress_first_run_page")->AsBool()); 203 ASSERT_FALSE(filterEngine->GetPref("suppress_first_run_page")->AsBool());
204 } 204 }
OLDNEW
« src/Thread.h ('K') | « test/GlobalJsObject.cpp ('k') | test/Thread.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld