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

Side by Side Diff: test/UpdateCheck.cpp

Issue 29442622: Noissue - move (UpdaterTest, SetRemoveUpdateAvailableCallback) to UpdateCheck.cpp (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: Created May 19, 2017, 4:48 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/FilterEngine.cpp ('k') | no next file » | 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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 255
256 CreateFilterEngine(); 256 CreateFilterEngine();
257 ForceUpdateCheck(); 257 ForceUpdateCheck();
258 258
259 ProcessPendingUpdateWebRequest(); 259 ProcessPendingUpdateWebRequest();
260 260
261 ASSERT_FALSE(eventCallbackCalled); 261 ASSERT_FALSE(eventCallbackCalled);
262 ASSERT_TRUE(updateCallbackCalled); 262 ASSERT_TRUE(updateCallbackCalled);
263 ASSERT_FALSE(updateError.empty()); 263 ASSERT_FALSE(updateError.empty());
264 } 264 }
265
266 TEST_F(UpdateCheckTest, SetRemoveUpdateAvailableCallback)
267 {
268 webRequestResponse.status = 0;
269 webRequestResponse.responseStatus = 200;
270 webRequestResponse.responseText = "\
271 {\
272 \"test\": {\
273 \"version\": \"1.0.2\",\
274 \"url\": \"https://downloads.adblockplus.org/test-1.0.2.tar.gz?update\"\
275 }\
276 }";
277
278 appInfo.name = "test";
279 appInfo.version = "1.0.1";
280 CreateFilterEngine();
281
282 int timesCalled = 0;
283 filterEngine->SetUpdateAvailableCallback([&timesCalled](const std::string&)->v oid
284 {
285 ++timesCalled;
286 });
287 ForceUpdateCheck();
288
289 // ensure that the was the corresponding request
290 EXPECT_FALSE(ProcessPendingUpdateWebRequest().empty());
291
292 EXPECT_EQ(1, timesCalled);
293
294 // filterEngine->SetUpdateAvailableCallback overriddes previously installed on JsEngine
295 // handler for "updateAvailable" event.
296 EXPECT_FALSE(eventCallbackCalled);
297
298 filterEngine->RemoveUpdateAvailableCallback();
299 ForceUpdateCheck();
300
301 // ensure that the was the corresponding request
302 EXPECT_FALSE(ProcessPendingUpdateWebRequest().empty());
303
304 EXPECT_FALSE(eventCallbackCalled);
305 EXPECT_EQ(1, timesCalled);
306
307 // previous handler is not restored
308 EXPECT_FALSE(eventCallbackCalled);
309 }
OLDNEW
« no previous file with comments | « test/FilterEngine.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld