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

Side by Side Diff: test/UpdateCheck.cpp

Issue 29371607: Issue #3593 - Make isolate a fully internal member of the engine
Patch Set: improve unit tests to go with isolate change Created Jan. 16, 2017, 3:53 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/Prefs.cpp ('k') | test/WebRequest.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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 jsEngine->SetWebRequest(webRequest); 55 jsEngine->SetWebRequest(webRequest);
56 jsEngine->SetEventCallback("updateAvailable", 56 jsEngine->SetEventCallback("updateAvailable",
57 std::bind(&UpdateCheckTest::EventCallback, this, std::placeholders::_1)) ; 57 std::bind(&UpdateCheckTest::EventCallback, this, std::placeholders::_1)) ;
58 58
59 filterEngine = std::make_shared<AdblockPlus::FilterEngine>(jsEngine); 59 filterEngine = std::make_shared<AdblockPlus::FilterEngine>(jsEngine);
60 } 60 }
61 61
62 void Destroy() 62 void Destroy()
63 { 63 {
64 webRequest->Cancel(); 64 webRequest->Cancel();
65 eventCallbackParams.clear();
65 filterEngine.reset(); 66 filterEngine.reset();
66 ToInternal(jsEngine)->WaitForQuietScheduler(); 67 ToInternal(jsEngine)->WaitForQuietScheduler();
68 ASSERT_EQ(1, jsEngine.use_count());
67 jsEngine.reset(); 69 jsEngine.reset();
68 ASSERT_EQ(0, jsEngine.use_count());
69 } 70 }
70 71
71 protected: 72 protected:
72 AdblockPlus::AppInfo appInfo; 73 AdblockPlus::AppInfo appInfo;
73 std::shared_ptr<TestWebRequest> webRequest; 74 std::shared_ptr<TestWebRequest> webRequest;
74 AdblockPlus::JsEnginePtr jsEngine; 75 AdblockPlus::JsEnginePtr jsEngine;
75 FilterEnginePtr filterEngine; 76 FilterEnginePtr filterEngine;
76 77
77 bool eventCallbackCalled; 78 bool eventCallbackCalled;
78 AdblockPlus::JsValueList eventCallbackParams; 79 AdblockPlus::JsValueList eventCallbackParams;
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 276
276 Reset(); 277 Reset();
277 ForceUpdateCheck(); 278 ForceUpdateCheck();
278 279
279 std::this_thread::sleep_for(std::chrono::milliseconds(100)); 280 std::this_thread::sleep_for(std::chrono::milliseconds(100));
280 281
281 ASSERT_FALSE(eventCallbackCalled); 282 ASSERT_FALSE(eventCallbackCalled);
282 ASSERT_TRUE(updateCallbackCalled); 283 ASSERT_TRUE(updateCallbackCalled);
283 ASSERT_FALSE(updateError.empty()); 284 ASSERT_FALSE(updateError.empty());
284 } 285 }
OLDNEW
« no previous file with comments | « test/Prefs.cpp ('k') | test/WebRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld