Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(855)

Unified Diff: components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc

Issue 2795053002: [subresource_filter] Implement the "Smart" UI on Android (Closed)
Patch Set: fix tests Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc
diff --git a/components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc b/components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc
index 37d845df53acb279da4282f6c34d00d5839f92d4..e693b316e5f79088d4dc387634da6b942c79fde3 100644
--- a/components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc
+++ b/components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc
@@ -189,7 +189,7 @@ class MockSubresourceFilterClient : public SubresourceFilterClient {
void WhitelistByContentSettings(const GURL& url) override {}
- MOCK_METHOD1(ToggleNotificationVisibility, void(bool));
+ MOCK_METHOD2(ToggleNotificationVisibility, void(const GURL&, bool));
private:
DISALLOW_COPY_AND_ASSIGN(MockSubresourceFilterClient);
@@ -261,7 +261,9 @@ class ContentSubresourceFilterDriverFactoryTest
const bool expected_activation =
expected_activation_decision == ActivationDecision::ACTIVATED;
base::HistogramTester tester;
- EXPECT_CALL(*client(), ToggleNotificationVisibility(false)).Times(1);
+ EXPECT_CALL(*client(),
+ ToggleNotificationVisibility(navigation_chain.front(), false))
+ .Times(1);
std::unique_ptr<content::NavigationSimulator> navigation_simulator =
content::NavigationSimulator::CreateRendererInitiated(
@@ -319,7 +321,9 @@ class ContentSubresourceFilterDriverFactoryTest
}
void NavigateAndCommitSubframe(const GURL& url, bool expected_activation) {
- EXPECT_CALL(*client(), ToggleNotificationVisibility(::testing::_)).Times(0);
+ EXPECT_CALL(*client(),
+ ToggleNotificationVisibility(::testing::_, ::testing::_))
+ .Times(0);
content::NavigationSimulator::NavigateAndCommitFromDocument(
url, GetSubframeRFH());
@@ -366,7 +370,7 @@ class ContentSubresourceFilterDriverFactoryTest
}
void EmulateFailedNavigationAndExpectNoActivation(const GURL& url) {
- EXPECT_CALL(*client(), ToggleNotificationVisibility(false)).Times(1);
+ EXPECT_CALL(*client(), ToggleNotificationVisibility(url, false)).Times(1);
// With browser-side navigation enabled, ReadyToCommitNavigation is invoked
// even for failed navigations. This is correctly simulated by
@@ -392,7 +396,9 @@ class ContentSubresourceFilterDriverFactoryTest
NavigateAndExpectActivation(blacklisted_urls, {GURL(kExampleUrl)},
expected_pattern, expected_activation_decision);
- EXPECT_CALL(*client(), ToggleNotificationVisibility(::testing::_)).Times(0);
+ EXPECT_CALL(*client(),
+ ToggleNotificationVisibility(::testing::_, ::testing::_))
+ .Times(0);
std::unique_ptr<content::NavigationSimulator> navigation_simulator =
content::NavigationSimulator::CreateRendererInitiated(GURL(kExampleUrl),
main_rfh());
@@ -624,9 +630,10 @@ TEST_F(ContentSubresourceFilterDriverFactoryTest, NotificationVisibility) {
base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled,
kActivationScopeAllSites);
- NavigateAndExpectActivation({false}, {GURL(kExampleUrl)}, EMPTY,
+ GURL url(kExampleUrl);
+ NavigateAndExpectActivation({false}, {url}, EMPTY,
ActivationDecision::ACTIVATED);
- EXPECT_CALL(*client(), ToggleNotificationVisibility(true)).Times(1);
+ EXPECT_CALL(*client(), ToggleNotificationVisibility(url, true)).Times(1);
EmulateDidDisallowFirstSubresourceMessage();
}
@@ -641,7 +648,9 @@ TEST_F(ContentSubresourceFilterDriverFactoryTest,
NavigateAndExpectActivation({false}, {GURL(kExampleUrl)}, EMPTY,
ActivationDecision::ACTIVATED);
- EXPECT_CALL(*client(), ToggleNotificationVisibility(::testing::_)).Times(0);
+ EXPECT_CALL(*client(),
+ ToggleNotificationVisibility(::testing::_, ::testing::_))
+ .Times(0);
EmulateDidDisallowFirstSubresourceMessage();
}

Powered by Google App Engine
This is Rietveld 408576698