| OLD | NEW |
| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 platformParams.fileSystem.reset(fileSystem = new LazyFileSystem()); | 61 platformParams.fileSystem.reset(fileSystem = new LazyFileSystem()); |
| 62 platformParams.webRequest = DelayedWebRequest::New(webRequestTasks); | 62 platformParams.webRequest = DelayedWebRequest::New(webRequestTasks); |
| 63 platform.reset(new Platform(std::move(platformParams))); | 63 platform.reset(new Platform(std::move(platformParams))); |
| 64 platform->SetUpJsEngine(appInfo); | 64 platform->SetUpJsEngine(appInfo); |
| 65 platform->GetJsEngine()->SetEventCallback("updateAvailable", [this](JsValu
eList&& params) | 65 platform->GetJsEngine()->SetEventCallback("updateAvailable", [this](JsValu
eList&& params) |
| 66 { | 66 { |
| 67 eventCallbackCalled = true; | 67 eventCallbackCalled = true; |
| 68 eventCallbackParams = std::move(params); | 68 eventCallbackParams = std::move(params); |
| 69 }); | 69 }); |
| 70 | 70 |
| 71 filterEngine = ::CreateFilterEngine(*fileSystem, platform->GetJsEngine()); | 71 filterEngine = ::CreateFilterEngine(*fileSystem, *platform); |
| 72 } | 72 } |
| 73 | 73 |
| 74 // Returns a URL or the empty string if there is no such request. | 74 // Returns a URL or the empty string if there is no such request. |
| 75 std::string ProcessPendingUpdateWebRequest() | 75 std::string ProcessPendingUpdateWebRequest() |
| 76 { | 76 { |
| 77 auto ii = webRequestTasks->begin(); | 77 auto ii = webRequestTasks->begin(); |
| 78 while (ii != webRequestTasks->end()) | 78 while (ii != webRequestTasks->end()) |
| 79 { | 79 { |
| 80 if (ii->url.find("update.json") != std::string::npos) | 80 if (ii->url.find("update.json") != std::string::npos) |
| 81 { | 81 { |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 301 |
| 302 // ensure that the was the corresponding request | 302 // ensure that the was the corresponding request |
| 303 EXPECT_FALSE(ProcessPendingUpdateWebRequest().empty()); | 303 EXPECT_FALSE(ProcessPendingUpdateWebRequest().empty()); |
| 304 | 304 |
| 305 EXPECT_FALSE(eventCallbackCalled); | 305 EXPECT_FALSE(eventCallbackCalled); |
| 306 EXPECT_EQ(1, timesCalled); | 306 EXPECT_EQ(1, timesCalled); |
| 307 | 307 |
| 308 // previous handler is not restored | 308 // previous handler is not restored |
| 309 EXPECT_FALSE(eventCallbackCalled); | 309 EXPECT_FALSE(eventCallbackCalled); |
| 310 } | 310 } |
| OLD | NEW |