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

Delta Between Two Patch Sets: test/FilterEngine.cpp

Issue 29419623: Issue 5165 - Remove SubscriptionPtr (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Left Patch Set: Make Subscription(JsValue&&) protected Created April 21, 2017, 3:46 p.m.
Right Patch Set: Call the inherited operator Created April 24, 2017, 8:13 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/FilterEngine.cpp ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 } 932 }
933 void testSubscriptionState(AAStatus aaStatus, int otherSubscriptionsNumber) 933 void testSubscriptionState(AAStatus aaStatus, int otherSubscriptionsNumber)
934 { 934 {
935 if (aaStatus == AAStatus::enabled) 935 if (aaStatus == AAStatus::enabled)
936 EXPECT_TRUE(filterEngine->IsAAEnabled()); 936 EXPECT_TRUE(filterEngine->IsAAEnabled());
937 else 937 else
938 EXPECT_FALSE(filterEngine->IsAAEnabled()); 938 EXPECT_FALSE(filterEngine->IsAAEnabled());
939 939
940 std::unique_ptr<Subscription> aaSubscription; 940 std::unique_ptr<Subscription> aaSubscription;
941 std::unique_ptr<Subscription> otherSubscription; 941 std::unique_ptr<Subscription> otherSubscription;
942 const auto subscriptions = filterEngine->GetListedSubscriptions(); 942 auto subscriptions = filterEngine->GetListedSubscriptions();
943 for (const auto& subscription : subscriptions) 943 for (auto& subscription : subscriptions)
944 { 944 {
945 (subscription.IsAA() ? aaSubscription : otherSubscription) = 945 (subscription.IsAA() ? aaSubscription : otherSubscription) =
946 std::unique_ptr<Subscription>(new Subscription(subscription)); 946 std::unique_ptr<Subscription>(new Subscription(std::move(subscription) ));
947 } 947 }
948 if (otherSubscriptionsNumber == 1u) 948 if (otherSubscriptionsNumber == 1u)
949 { 949 {
950 if (isAASatusPresent(aaStatus)) 950 if (isAASatusPresent(aaStatus))
951 { 951 {
952 EXPECT_EQ(2u, subscriptions.size()); 952 EXPECT_EQ(2u, subscriptions.size());
953 EXPECT_TRUE(aaSubscription); 953 EXPECT_TRUE(aaSubscription);
954 EXPECT_TRUE(otherSubscription); 954 EXPECT_TRUE(otherSubscription);
955 } 955 }
956 else 956 else
(...skipping 27 matching lines...) Expand all
984 uint8_t otherSubscriptionsNumber = ::testing::get<1>(GetParam()); 984 uint8_t otherSubscriptionsNumber = ::testing::get<1>(GetParam());
985 init(parameter.initialAAStatus, otherSubscriptionsNumber); 985 init(parameter.initialAAStatus, otherSubscriptionsNumber);
986 986
987 if (parameter.action == Action::enable) 987 if (parameter.action == Action::enable)
988 filterEngine->SetAAEnabled(true); 988 filterEngine->SetAAEnabled(true);
989 else if (parameter.action == Action::disable) 989 else if (parameter.action == Action::disable)
990 filterEngine->SetAAEnabled(false); 990 filterEngine->SetAAEnabled(false);
991 else if (parameter.action == Action::remove) 991 else if (parameter.action == Action::remove)
992 { 992 {
993 std::unique_ptr<Subscription> aaSubscription; 993 std::unique_ptr<Subscription> aaSubscription;
994 for (const auto& subscription : filterEngine->GetListedSubscriptions()) 994 for (auto& subscription : filterEngine->GetListedSubscriptions())
995 { 995 {
996 if (subscription.IsAA()) 996 if (subscription.IsAA())
997 { 997 {
998 aaSubscription.reset(new Subscription(subscription)); 998 aaSubscription.reset(new Subscription(std::move(subscription)));
999 break; 999 break;
1000 } 1000 }
1001 } 1001 }
1002 ASSERT_TRUE(aaSubscription); 1002 ASSERT_TRUE(aaSubscription);
1003 aaSubscription->RemoveFromList(); 1003 aaSubscription->RemoveFromList();
1004 } 1004 }
1005 1005
1006 testSubscriptionState(parameter.expectedAAStatus, otherSubscriptionsNumber); 1006 testSubscriptionState(parameter.expectedAAStatus, otherSubscriptionsNumber);
1007 } 1007 }
1008 } 1008 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 filterEngine->SetAllowedConnectionType(&testConnection); 1088 filterEngine->SetAllowedConnectionType(&testConnection);
1089 auto subscription = EnsureExampleSubscriptionAndForceUpdate("subB"); 1089 auto subscription = EnsureExampleSubscriptionAndForceUpdate("subB");
1090 EXPECT_EQ("synchronize_ok", subscription.GetProperty("downloadStatus").AsStr ing()); 1090 EXPECT_EQ("synchronize_ok", subscription.GetProperty("downloadStatus").AsStr ing());
1091 EXPECT_EQ(1u, subscription.GetProperty("filters").AsList().size()); 1091 EXPECT_EQ(1u, subscription.GetProperty("filters").AsList().size());
1092 auto capturedConnectionTypes = this->capturedConnectionTypes.GetStrings(); 1092 auto capturedConnectionTypes = this->capturedConnectionTypes.GetStrings();
1093 ASSERT_EQ(1u, capturedConnectionTypes.size()); 1093 ASSERT_EQ(1u, capturedConnectionTypes.size());
1094 EXPECT_TRUE(capturedConnectionTypes[0].first); 1094 EXPECT_TRUE(capturedConnectionTypes[0].first);
1095 EXPECT_EQ(testConnection, capturedConnectionTypes[0].second); 1095 EXPECT_EQ(testConnection, capturedConnectionTypes[0].second);
1096 } 1096 }
1097 } 1097 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld