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

Side by Side Diff: test/Prefs.cpp

Issue 29377064: Issue 4944 - Make creation of FilterEngine asynchronous. (Closed)
Patch Set: rebase and address comments Created March 16, 2017, 3:47 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
« no previous file with comments | « test/Notification.cpp ('k') | test/UpdateCheck.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 Reset(); 78 Reset();
79 } 79 }
80 80
81 void Reset(const AdblockPlus::FilterEngine::Prefs& preconfiguredPrefs = 81 void Reset(const AdblockPlus::FilterEngine::Prefs& preconfiguredPrefs =
82 AdblockPlus::FilterEngine::Prefs()) 82 AdblockPlus::FilterEngine::Prefs())
83 { 83 {
84 jsEngine = CreateJsEngine(); 84 jsEngine = CreateJsEngine();
85 jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(new LazyLogSystem)); 85 jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(new LazyLogSystem));
86 jsEngine->SetFileSystem(fileSystemPtr); 86 jsEngine->SetFileSystem(fileSystemPtr);
87 jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(new LazyWebRequest)); 87 jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(new LazyWebRequest));
88 88 AdblockPlus::FilterEngine::CreationParameters createParams;
89 filterEngine.reset( 89 createParams.preconfiguredPrefs = preconfiguredPrefs;
90 new AdblockPlus::FilterEngine(jsEngine, preconfiguredPrefs)); 90 filterEngine = AdblockPlus::FilterEngine::Create(jsEngine, createParams);
91 } 91 }
92 }; 92 };
93 } 93 }
94 94
95 TEST_F(PrefsTest, PrefsGetSet) 95 TEST_F(PrefsTest, PrefsGetSet)
96 { 96 {
97 ASSERT_EQ("patterns.ini", filterEngine->GetPref("patternsfile")->AsString()); 97 ASSERT_EQ("patterns.ini", filterEngine->GetPref("patternsfile")->AsString());
98 ASSERT_EQ(24, filterEngine->GetPref("patternsbackupinterval")->AsInt()); 98 ASSERT_EQ(24, filterEngine->GetPref("patternsbackupinterval")->AsInt());
99 ASSERT_TRUE(filterEngine->GetPref("subscriptions_autoupdate")->AsBool()); 99 ASSERT_TRUE(filterEngine->GetPref("subscriptions_autoupdate")->AsBool());
100 ASSERT_TRUE(filterEngine->GetPref("foobar")->IsUndefined()); 100 ASSERT_TRUE(filterEngine->GetPref("foobar")->IsUndefined());
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 195
196 AdblockPlus::Sleep(100); 196 AdblockPlus::Sleep(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
« no previous file with comments | « test/Notification.cpp ('k') | test/UpdateCheck.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld