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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 exampleSubscriptionResponse.responseStatus = 200; | 227 exampleSubscriptionResponse.responseStatus = 200; |
228 exampleSubscriptionResponse.status = WebRequest::NS_OK; | 228 exampleSubscriptionResponse.status = WebRequest::NS_OK; |
229 exampleSubscriptionResponse.responseText = "[Adblock Plus 2.0]\n||example.
com"; | 229 exampleSubscriptionResponse.responseText = "[Adblock Plus 2.0]\n||example.
com"; |
230 webRequest->responses.emplace(subscriptionUrlPrefix, exampleSubscriptionRe
sponse); | 230 webRequest->responses.emplace(subscriptionUrlPrefix, exampleSubscriptionRe
sponse); |
231 createParams.preconfiguredPrefs["first_run_subscription_auto_select"] = js
Engine->NewValue(false); | 231 createParams.preconfiguredPrefs["first_run_subscription_auto_select"] = js
Engine->NewValue(false); |
232 isConnectionAllowed = true; | 232 isConnectionAllowed = true; |
233 createParams.isConnectionAllowedCallback = [this](const std::string* allow
edConnectionType)->bool{ | 233 createParams.isConnectionAllowedCallback = [this](const std::string* allow
edConnectionType)->bool{ |
234 capturedConnectionTypes.Add(allowedConnectionType); | 234 capturedConnectionTypes.Add(allowedConnectionType); |
235 return isConnectionAllowed; | 235 return isConnectionAllowed; |
236 }; | 236 }; |
237 jsEngine->SetEventCallback("filterChange", [this](const JsValueList& param
s/*action, item*/) | 237 jsEngine->SetEventCallback("filterChange", [this](const JsConstValueList&
params/*action, item*/) |
238 { | 238 { |
239 ASSERT_EQ(2u, params.size()); | 239 ASSERT_EQ(2u, params.size()); |
240 if (params[0]->AsString() == "subscription.downloadStatus") | 240 if (params[0]->AsString() == "subscription.downloadStatus") |
241 { | 241 { |
242 { | 242 { |
243 std::lock_guard<std::mutex> lock(downloadStatusChanged.mutex); | 243 std::lock_guard<std::mutex> lock(downloadStatusChanged.mutex); |
244 downloadStatusChanged.url = params[1]->GetProperty("url")->AsString(
); | 244 downloadStatusChanged.url = params[1]->GetProperty("url")->AsString(
); |
245 } | 245 } |
246 downloadStatusChanged.cv.notify_one(); | 246 downloadStatusChanged.cv.notify_one(); |
247 } | 247 } |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 filterEngine->SetAllowedConnectionType(&testConnection); | 1086 filterEngine->SetAllowedConnectionType(&testConnection); |
1087 auto subscription = EnsureExampleSubscriptionAndForceUpdate("subB"); | 1087 auto subscription = EnsureExampleSubscriptionAndForceUpdate("subB"); |
1088 EXPECT_EQ("synchronize_ok", subscription->GetProperty("downloadStatus")->AsS
tring()); | 1088 EXPECT_EQ("synchronize_ok", subscription->GetProperty("downloadStatus")->AsS
tring()); |
1089 EXPECT_EQ(1u, subscription->GetProperty("filters")->AsList().size()); | 1089 EXPECT_EQ(1u, subscription->GetProperty("filters")->AsList().size()); |
1090 auto capturedConnectionTypes = this->capturedConnectionTypes.GetStrings(); | 1090 auto capturedConnectionTypes = this->capturedConnectionTypes.GetStrings(); |
1091 ASSERT_EQ(1u, capturedConnectionTypes.size()); | 1091 ASSERT_EQ(1u, capturedConnectionTypes.size()); |
1092 EXPECT_TRUE(capturedConnectionTypes[0].first); | 1092 EXPECT_TRUE(capturedConnectionTypes[0].first); |
1093 EXPECT_EQ(testConnection, capturedConnectionTypes[0].second); | 1093 EXPECT_EQ(testConnection, capturedConnectionTypes[0].second); |
1094 } | 1094 } |
1095 } | 1095 } |
OLD | NEW |