OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/subresource_filter/content/browser/content_subresource_filt er_driver_factory.h" | 5 #include "components/subresource_filter/content/browser/content_subresource_filt er_driver_factory.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/test/histogram_tester.h" | 10 #include "base/test/histogram_tester.h" |
11 #include "components/safe_browsing_db/util.h" | 11 #include "components/safe_browsing_db/util.h" |
12 #include "components/subresource_filter/content/common/subresource_filter_messag es.h" | 12 #include "components/subresource_filter/content/common/subresource_filter_messag es.h" |
13 #include "components/subresource_filter/core/browser/subresource_filter_client.h " | 13 #include "components/subresource_filter/core/browser/subresource_filter_client.h " |
14 #include "components/subresource_filter/core/browser/subresource_filter_features .h" | 14 #include "components/subresource_filter/core/browser/subresource_filter_features .h" |
15 #include "components/subresource_filter/core/browser/subresource_filter_features _test_support.h" | 15 #include "components/subresource_filter/core/browser/subresource_filter_features _test_support.h" |
16 #include "content/public/browser/render_frame_host.h" | |
16 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
17 #include "content/public/common/browser_side_navigation_policy.h" | 18 #include "content/public/common/browser_side_navigation_policy.h" |
engedy
2017/03/02 10:38:10
nit: No longer needed.
clamy
2017/03/02 13:11:17
Done.
| |
18 #include "content/public/test/mock_render_process_host.h" | 19 #include "content/public/test/mock_render_process_host.h" |
20 #include "content/public/test/navigation_simulator.h" | |
19 #include "content/public/test/test_renderer_host.h" | 21 #include "content/public/test/test_renderer_host.h" |
20 #include "content/public/test/web_contents_tester.h" | 22 #include "content/public/test/web_contents_tester.h" |
23 #include "net/base/net_errors.h" | |
21 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
23 #include "url/gurl.h" | 26 #include "url/gurl.h" |
24 | 27 |
25 namespace subresource_filter { | 28 namespace subresource_filter { |
26 | 29 |
27 using ActivationDecision = | 30 using ActivationDecision = |
28 ContentSubresourceFilterDriverFactory::ActivationDecision; | 31 ContentSubresourceFilterDriverFactory::ActivationDecision; |
29 | 32 |
30 namespace { | 33 namespace { |
31 | 34 |
32 const char kExampleUrlWithParams[] = "https://example.com/soceng?q=engsoc"; | 35 const char kExampleUrlWithParams[] = "https://example.com/soceng?q=engsoc"; |
33 const char kExampleUrl[] = "https://example.com"; | 36 const char kExampleUrl[] = "https://example.com"; |
34 const char kExampleLoginUrl[] = "https://example.com/login"; | 37 const char kExampleLoginUrl[] = "https://example.com/login"; |
35 const char kMatchesPatternHistogramName[] = | 38 const char kMatchesPatternHistogramName[] = |
36 "SubresourceFilter.PageLoad.RedirectChainMatchPattern"; | 39 "SubresourceFilter.PageLoad.RedirectChainMatchPattern"; |
37 const char kNavigationChainSize[] = | 40 const char kNavigationChainSize[] = |
38 "SubresourceFilter.PageLoad.RedirectChainLength"; | 41 "SubresourceFilter.PageLoad.RedirectChainLength"; |
39 const char kUrlA[] = "https://example_a.com"; | 42 const char kUrlA[] = "https://example_a.com"; |
40 const char kUrlB[] = "https://example_b.com"; | 43 const char kUrlB[] = "https://example_b.com"; |
41 const char kUrlC[] = "https://example_c.com"; | 44 const char kUrlC[] = "https://example_c.com"; |
42 const char kUrlD[] = "https://example_d.com"; | 45 const char kUrlD[] = "https://example_d.com"; |
46 const char kSubframeName[] = "Child"; | |
43 | 47 |
44 // Human readable representation of expected redirect chain match patterns. | 48 // Human readable representation of expected redirect chain match patterns. |
45 // The explanations for the buckets given for the following redirect chain: | 49 // The explanations for the buckets given for the following redirect chain: |
46 // A->B->C->D, where A is initial URL and D is a final URL. | 50 // A->B->C->D, where A is initial URL and D is a final URL. |
47 enum RedirectChainMatchPattern { | 51 enum RedirectChainMatchPattern { |
48 EMPTY, // No histograms were recorded. | 52 EMPTY, // No histograms were recorded. |
49 F0M0L1, // D is a Safe Browsing match. | 53 F0M0L1, // D is a Safe Browsing match. |
50 F0M1L0, // B or C, or both are Safe Browsing matches. | 54 F0M1L0, // B or C, or both are Safe Browsing matches. |
51 F0M1L1, // B or C, or both and D are Safe Browsing matches. | 55 F0M1L1, // B or C, or both and D are Safe Browsing matches. |
52 F1M0L0, // A is Safe Browsing match | 56 F1M0L0, // A is Safe Browsing match |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 RenderViewHostTestHarness::SetUp(); | 182 RenderViewHostTestHarness::SetUp(); |
179 | 183 |
180 client_ = new MockSubresourceFilterClient(); | 184 client_ = new MockSubresourceFilterClient(); |
181 ContentSubresourceFilterDriverFactory::CreateForWebContents( | 185 ContentSubresourceFilterDriverFactory::CreateForWebContents( |
182 web_contents(), base::WrapUnique(client())); | 186 web_contents(), base::WrapUnique(client())); |
183 | 187 |
184 // Add a subframe. | 188 // Add a subframe. |
185 content::RenderFrameHostTester* rfh_tester = | 189 content::RenderFrameHostTester* rfh_tester = |
186 content::RenderFrameHostTester::For(main_rfh()); | 190 content::RenderFrameHostTester::For(main_rfh()); |
187 rfh_tester->InitializeRenderFrameIfNeeded(); | 191 rfh_tester->InitializeRenderFrameIfNeeded(); |
188 subframe_rfh_ = rfh_tester->AppendChild("Child"); | 192 subframe_rfh_ = rfh_tester->AppendChild(kSubframeName); |
189 } | 193 } |
190 | 194 |
191 ContentSubresourceFilterDriverFactory* factory() { | 195 ContentSubresourceFilterDriverFactory* factory() { |
192 return ContentSubresourceFilterDriverFactory::FromWebContents( | 196 return ContentSubresourceFilterDriverFactory::FromWebContents( |
193 web_contents()); | 197 web_contents()); |
194 } | 198 } |
195 | 199 |
196 MockSubresourceFilterClient* client() { return client_; } | 200 MockSubresourceFilterClient* client() { return client_; } |
197 content::RenderFrameHost* subframe_rfh() { return subframe_rfh_; } | 201 content::RenderFrameHost* subframe_rfh() { return subframe_rfh_; } |
198 | 202 |
199 void ExpectActivationSignalForFrame(content::RenderFrameHost* rfh, | 203 void ExpectActivationSignalForFrame(content::RenderFrameHost* rfh, |
200 bool expect_activation) { | 204 bool expect_activation) { |
201 content::MockRenderProcessHost* render_process_host = | 205 content::MockRenderProcessHost* render_process_host = |
202 static_cast<content::MockRenderProcessHost*>(rfh->GetProcess()); | 206 static_cast<content::MockRenderProcessHost*>(rfh->GetProcess()); |
203 const IPC::Message* message = | 207 const IPC::Message* message = |
204 render_process_host->sink().GetFirstMessageMatching( | 208 render_process_host->sink().GetFirstMessageMatching( |
205 SubresourceFilterMsg_ActivateForNextCommittedLoad::ID); | 209 SubresourceFilterMsg_ActivateForNextCommittedLoad::ID); |
206 ASSERT_EQ(expect_activation, !!message); | 210 ASSERT_EQ(expect_activation, !!message); |
207 if (expect_activation) { | 211 if (expect_activation) { |
208 std::tuple<ActivationLevel, bool> args; | 212 std::tuple<ActivationLevel, bool> args; |
209 SubresourceFilterMsg_ActivateForNextCommittedLoad::Read(message, &args); | 213 SubresourceFilterMsg_ActivateForNextCommittedLoad::Read(message, &args); |
210 EXPECT_NE(ActivationLevel::DISABLED, std::get<0>(args)); | 214 EXPECT_NE(ActivationLevel::DISABLED, std::get<0>(args)); |
211 } | 215 } |
212 render_process_host->sink().ClearMessages(); | 216 render_process_host->sink().ClearMessages(); |
213 } | 217 } |
214 | 218 |
215 void SimulateNavigationCommit(content::RenderFrameHost* rfh, | |
216 const GURL& url, | |
217 const content::Referrer& referrer, | |
218 const ui::PageTransition transition) { | |
219 // TODO(crbug.com/688393): Once WCO::ReadyToCommitNavigation is invoked | |
220 // consistently for tests in PlzNavigate and non-PlzNavigate, remove this. | |
221 if (!content::IsBrowserSideNavigationEnabled()) { | |
222 factory()->ReadyToCommitNavigationInternal(rfh, url, referrer, | |
223 transition); | |
224 } | |
225 content::RenderFrameHostTester::For(rfh)->SimulateNavigationCommit(url); | |
226 } | |
227 | |
228 void BlacklistURLWithRedirectsNavigateAndCommit( | 219 void BlacklistURLWithRedirectsNavigateAndCommit( |
229 const std::vector<bool>& blacklisted_urls, | 220 const std::vector<bool>& blacklisted_urls, |
230 const std::vector<GURL>& navigation_chain, | 221 const std::vector<GURL>& navigation_chain, |
231 safe_browsing::SBThreatType threat_type, | 222 safe_browsing::SBThreatType threat_type, |
232 safe_browsing::ThreatPatternType threat_type_metadata, | 223 safe_browsing::ThreatPatternType threat_type_metadata, |
233 const content::Referrer& referrer, | 224 const content::Referrer& referrer, |
234 ui::PageTransition transition, | 225 ui::PageTransition transition, |
235 RedirectChainMatchPattern expected_pattern, | 226 RedirectChainMatchPattern expected_pattern, |
236 ActivationDecision expected_activation_decision) { | 227 ActivationDecision expected_activation_decision) { |
237 const bool expected_activation = | 228 const bool expected_activation = |
238 expected_activation_decision == ActivationDecision::ACTIVATED; | 229 expected_activation_decision == ActivationDecision::ACTIVATED; |
239 base::HistogramTester tester; | 230 base::HistogramTester tester; |
240 EXPECT_CALL(*client(), ToggleNotificationVisibility(false)).Times(1); | 231 EXPECT_CALL(*client(), ToggleNotificationVisibility(false)).Times(1); |
241 content::RenderFrameHostTester* rfh_tester = | |
242 content::RenderFrameHostTester::For(main_rfh()); | |
243 | 232 |
244 rfh_tester->SimulateNavigationStart(navigation_chain.front()); | 233 std::unique_ptr<content::NavigationSimulator> navigation_simulator = |
234 content::NavigationSimulator::CreateRendererInitiated( | |
235 navigation_chain.front(), main_rfh()); | |
236 navigation_simulator->SetReferrer(referrer); | |
237 navigation_simulator->SetTransition(transition); | |
238 navigation_simulator->Start(); | |
239 | |
245 if (blacklisted_urls.front()) { | 240 if (blacklisted_urls.front()) { |
246 factory()->OnMainResourceMatchedSafeBrowsingBlacklist( | 241 factory()->OnMainResourceMatchedSafeBrowsingBlacklist( |
247 navigation_chain.front(), navigation_chain, threat_type, | 242 navigation_chain.front(), navigation_chain, threat_type, |
248 threat_type_metadata); | 243 threat_type_metadata); |
249 } | 244 } |
250 ::testing::Mock::VerifyAndClearExpectations(client()); | 245 ::testing::Mock::VerifyAndClearExpectations(client()); |
251 | 246 |
252 for (size_t i = 1; i < navigation_chain.size(); ++i) { | 247 for (size_t i = 1; i < navigation_chain.size(); ++i) { |
253 const GURL url = navigation_chain[i]; | 248 const GURL url = navigation_chain[i]; |
254 if (i < blacklisted_urls.size() && blacklisted_urls[i]) { | 249 if (i < blacklisted_urls.size() && blacklisted_urls[i]) { |
255 factory()->OnMainResourceMatchedSafeBrowsingBlacklist( | 250 factory()->OnMainResourceMatchedSafeBrowsingBlacklist( |
256 url, navigation_chain, threat_type, threat_type_metadata); | 251 url, navigation_chain, threat_type, threat_type_metadata); |
257 } | 252 } |
258 rfh_tester->SimulateRedirect(url); | 253 navigation_simulator->Redirect(url); |
259 } | 254 } |
260 | 255 |
261 SimulateNavigationCommit(main_rfh(), navigation_chain.back(), referrer, | 256 navigation_simulator->Commit(); |
262 transition); | |
263 ExpectActivationSignalForFrame(main_rfh(), expected_activation); | 257 ExpectActivationSignalForFrame(main_rfh(), expected_activation); |
264 EXPECT_EQ(expected_activation_decision, | 258 EXPECT_EQ(expected_activation_decision, |
265 factory()->GetActivationDecisionForLastCommittedPageLoad()); | 259 factory()->GetActivationDecisionForLastCommittedPageLoad()); |
266 | 260 |
261 // Re-create a subframe now that the frame has navigated. | |
262 content::RenderFrameHostTester* rfh_tester = | |
263 content::RenderFrameHostTester::For(main_rfh()); | |
264 subframe_rfh_ = rfh_tester->AppendChild(kSubframeName); | |
265 | |
267 if (expected_pattern != EMPTY) { | 266 if (expected_pattern != EMPTY) { |
268 EXPECT_THAT(tester.GetAllSamples(kMatchesPatternHistogramName), | 267 EXPECT_THAT(tester.GetAllSamples(kMatchesPatternHistogramName), |
269 ::testing::ElementsAre(base::Bucket(expected_pattern, 1))); | 268 ::testing::ElementsAre(base::Bucket(expected_pattern, 1))); |
270 EXPECT_THAT( | 269 EXPECT_THAT( |
271 tester.GetAllSamples(kNavigationChainSize), | 270 tester.GetAllSamples(kNavigationChainSize), |
272 ::testing::ElementsAre(base::Bucket(navigation_chain.size(), 1))); | 271 ::testing::ElementsAre(base::Bucket(navigation_chain.size(), 1))); |
273 | 272 |
274 } else { | 273 } else { |
275 EXPECT_THAT(tester.GetAllSamples(kMatchesPatternHistogramName), | 274 EXPECT_THAT(tester.GetAllSamples(kMatchesPatternHistogramName), |
276 ::testing::IsEmpty()); | 275 ::testing::IsEmpty()); |
277 EXPECT_THAT(tester.GetAllSamples(kNavigationChainSize), | 276 EXPECT_THAT(tester.GetAllSamples(kNavigationChainSize), |
278 ::testing::IsEmpty()); | 277 ::testing::IsEmpty()); |
279 } | 278 } |
280 } | 279 } |
281 | 280 |
282 void NavigateAndCommitSubframe(const GURL& url, bool expected_activation) { | 281 void NavigateAndCommitSubframe(const GURL& url, bool expected_activation) { |
283 EXPECT_CALL(*client(), ToggleNotificationVisibility(::testing::_)).Times(0); | 282 EXPECT_CALL(*client(), ToggleNotificationVisibility(::testing::_)).Times(0); |
284 | 283 |
285 content::RenderFrameHostTester::For(subframe_rfh()) | 284 content::NavigationSimulator::NavigateAndCommitFromDocument(url, |
286 ->SimulateNavigationStart(url); | 285 subframe_rfh()); |
287 SimulateNavigationCommit(subframe_rfh(), url, content::Referrer(), | 286 |
288 ui::PAGE_TRANSITION_LINK); | 287 // Update the subframe RFH as the navigation may have lead to a process |
engedy
2017/03/02 10:38:10
nit: Given that we need to go hunting for this sub
clamy
2017/03/02 13:11:17
I'll go with moving this block. We could have Navi
| |
288 // swap. | |
289 for (content::RenderFrameHost* rfh : web_contents()->GetAllFrames()) { | |
290 if (rfh->GetFrameName() == kSubframeName) { | |
291 subframe_rfh_ = rfh; | |
292 break; | |
293 } | |
294 } | |
289 ExpectActivationSignalForFrame(subframe_rfh(), expected_activation); | 295 ExpectActivationSignalForFrame(subframe_rfh(), expected_activation); |
290 ::testing::Mock::VerifyAndClearExpectations(client()); | 296 ::testing::Mock::VerifyAndClearExpectations(client()); |
291 } | 297 } |
292 | 298 |
293 void NavigateAndExpectActivation( | 299 void NavigateAndExpectActivation( |
294 const std::vector<bool>& blacklisted_urls, | 300 const std::vector<bool>& blacklisted_urls, |
295 const std::vector<GURL>& navigation_chain, | 301 const std::vector<GURL>& navigation_chain, |
296 safe_browsing::SBThreatType threat_type, | 302 safe_browsing::SBThreatType threat_type, |
297 safe_browsing::ThreatPatternType threat_type_metadata, | 303 safe_browsing::ThreatPatternType threat_type_metadata, |
298 const content::Referrer& referrer, | 304 const content::Referrer& referrer, |
(...skipping 25 matching lines...) Expand all Loading... | |
324 void EmulateDidDisallowFirstSubresourceMessage() { | 330 void EmulateDidDisallowFirstSubresourceMessage() { |
325 factory()->OnMessageReceived( | 331 factory()->OnMessageReceived( |
326 SubresourceFilterHostMsg_DidDisallowFirstSubresource( | 332 SubresourceFilterHostMsg_DidDisallowFirstSubresource( |
327 main_rfh()->GetRoutingID()), | 333 main_rfh()->GetRoutingID()), |
328 main_rfh()); | 334 main_rfh()); |
329 } | 335 } |
330 | 336 |
331 void EmulateFailedNavigationAndExpectNoActivation(const GURL& url) { | 337 void EmulateFailedNavigationAndExpectNoActivation(const GURL& url) { |
332 EXPECT_CALL(*client(), ToggleNotificationVisibility(false)).Times(1); | 338 EXPECT_CALL(*client(), ToggleNotificationVisibility(false)).Times(1); |
333 | 339 |
334 // ReadyToCommitNavigation with browser-side navigation disabled is not | 340 // ReadyToCommitNavigation with browser-side navigation disabled is not |
engedy
2017/03/02 10:38:10
nit: Update this comment, suggestion:
// With bro
clamy
2017/03/02 13:11:17
Done.
| |
335 // called in production code for failed navigations (e.g. network errors). | 341 // called in production code for failed navigations (e.g. network errors). |
336 // It is called with browser-side navigation enabled, in which case | 342 // It is called with browser-side navigation enabled, in which case |
337 // RenderFrameHostTester already calls it, no need to call it manually. | 343 // RenderFrameHostTester already calls it, no need to call it manually. |
338 content::RenderFrameHostTester* rfh_tester = | 344 content::NavigationSimulator::NavigateAndFailFromDocument( |
339 content::RenderFrameHostTester::For(main_rfh()); | 345 url, net::ERR_TIMED_OUT, main_rfh()); |
340 rfh_tester->SimulateNavigationStart(url); | |
341 rfh_tester->SimulateNavigationError(url, 403); | |
342 ExpectActivationSignalForFrame(main_rfh(), false); | 346 ExpectActivationSignalForFrame(main_rfh(), false); |
343 ::testing::Mock::VerifyAndClearExpectations(client()); | 347 ::testing::Mock::VerifyAndClearExpectations(client()); |
344 } | 348 } |
345 | 349 |
346 void EmulateInPageNavigation( | 350 void EmulateInPageNavigation( |
347 const std::vector<bool>& blacklisted_urls, | 351 const std::vector<bool>& blacklisted_urls, |
348 RedirectChainMatchPattern expected_pattern, | 352 RedirectChainMatchPattern expected_pattern, |
349 ActivationDecision expected_activation_decision) { | 353 ActivationDecision expected_activation_decision) { |
350 // This test examines the navigation with the following sequence of events: | 354 // This test examines the navigation with the following sequence of events: |
351 // DidStartProvisional(main, "example.com") | 355 // DidStartProvisional(main, "example.com") |
352 // ReadyToCommitNavigation(“example.com”) | 356 // ReadyToCommitNavigation(“example.com”) |
353 // DidCommitProvisional(main, "example.com") | 357 // DidCommitProvisional(main, "example.com") |
354 // DidStartProvisional(sub, "example.com/login") | 358 // DidStartProvisional(sub, "example.com/login") |
355 // DidCommitProvisional(sub, "example.com/login") | 359 // DidCommitProvisional(sub, "example.com/login") |
356 // DidCommitProvisional(main, "example.com#ref") | 360 // DidCommitProvisional(main, "example.com#ref") |
357 | 361 |
358 NavigateAndExpectActivation(blacklisted_urls, {GURL(kExampleUrl)}, | 362 NavigateAndExpectActivation(blacklisted_urls, {GURL(kExampleUrl)}, |
359 expected_pattern, expected_activation_decision); | 363 expected_pattern, expected_activation_decision); |
360 EXPECT_CALL(*client(), ToggleNotificationVisibility(::testing::_)).Times(0); | 364 EXPECT_CALL(*client(), ToggleNotificationVisibility(::testing::_)).Times(0); |
361 content::RenderFrameHostTester::For(main_rfh()) | 365 std::unique_ptr<content::NavigationSimulator> navigation_simulator = |
362 ->SimulateNavigationCommit(GURL(kExampleUrl)); | 366 content::NavigationSimulator::CreateRendererInitiated(GURL(kExampleUrl), |
367 main_rfh()); | |
368 navigation_simulator->CommitSamePage(); | |
363 ExpectActivationSignalForFrame(main_rfh(), false); | 369 ExpectActivationSignalForFrame(main_rfh(), false); |
364 ::testing::Mock::VerifyAndClearExpectations(client()); | 370 ::testing::Mock::VerifyAndClearExpectations(client()); |
365 } | 371 } |
366 | 372 |
367 private: | 373 private: |
368 static bool expected_measure_performance() { | 374 static bool expected_measure_performance() { |
369 const double rate = GetPerformanceMeasurementRate(); | 375 const double rate = GetPerformanceMeasurementRate(); |
370 // Note: The case when 0 < rate < 1 is not deterministic, don't test it. | 376 // Note: The case when 0 < rate < 1 is not deterministic, don't test it. |
371 EXPECT_TRUE(rate == 0 || rate == 1); | 377 EXPECT_TRUE(rate == 0 || rate == 1); |
372 return rate == 1; | 378 return rate == 1; |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
595 "" /* performance_measurement_rate */, | 601 "" /* performance_measurement_rate */, |
596 "true" /* suppress_notifications */); | 602 "true" /* suppress_notifications */); |
597 | 603 |
598 NavigateAndExpectActivation({false}, {GURL(kExampleUrl)}, EMPTY, | 604 NavigateAndExpectActivation({false}, {GURL(kExampleUrl)}, EMPTY, |
599 ActivationDecision::ACTIVATED); | 605 ActivationDecision::ACTIVATED); |
600 EXPECT_CALL(*client(), ToggleNotificationVisibility(::testing::_)).Times(0); | 606 EXPECT_CALL(*client(), ToggleNotificationVisibility(::testing::_)).Times(0); |
601 EmulateDidDisallowFirstSubresourceMessage(); | 607 EmulateDidDisallowFirstSubresourceMessage(); |
602 } | 608 } |
603 | 609 |
604 TEST_F(ContentSubresourceFilterDriverFactoryTest, WhitelistSiteOnReload) { | 610 TEST_F(ContentSubresourceFilterDriverFactoryTest, WhitelistSiteOnReload) { |
605 // TODO(crbug.com/688393): enable this test for PlzNavigate once | |
606 // WCO::ReadyToCommitNavigation is invoked consistently for tests in | |
607 // PlzNavigate and non-PlzNavigate. | |
608 if (content::IsBrowserSideNavigationEnabled()) | |
609 return; | |
610 | |
611 const struct { | 611 const struct { |
612 content::Referrer referrer; | 612 content::Referrer referrer; |
613 ui::PageTransition transition; | 613 ui::PageTransition transition; |
614 ActivationDecision expected_activation_decision; | 614 ActivationDecision expected_activation_decision; |
615 } kTestCases[] = { | 615 } kTestCases[] = { |
616 {content::Referrer(), ui::PAGE_TRANSITION_LINK, | 616 {content::Referrer(), ui::PAGE_TRANSITION_LINK, |
617 ActivationDecision::ACTIVATED}, | 617 ActivationDecision::ACTIVATED}, |
618 {content::Referrer(GURL(kUrlA), blink::WebReferrerPolicyDefault), | 618 {content::Referrer(GURL(kUrlA), blink::WebReferrerPolicyDefault), |
619 ui::PAGE_TRANSITION_LINK, ActivationDecision::ACTIVATED}, | 619 ui::PAGE_TRANSITION_LINK, ActivationDecision::ACTIVATED}, |
620 {content::Referrer(GURL(kExampleUrl), blink::WebReferrerPolicyDefault), | 620 {content::Referrer(GURL(kExampleUrl), blink::WebReferrerPolicyDefault), |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
760 ActivationScopeTest, | 760 ActivationScopeTest, |
761 ContentSubresourceFilterDriverFactoryActivationScopeTest, | 761 ContentSubresourceFilterDriverFactoryActivationScopeTest, |
762 ::testing::ValuesIn(kActivationScopeTestData)); | 762 ::testing::ValuesIn(kActivationScopeTestData)); |
763 | 763 |
764 INSTANTIATE_TEST_CASE_P( | 764 INSTANTIATE_TEST_CASE_P( |
765 ActivationLevelTest, | 765 ActivationLevelTest, |
766 ContentSubresourceFilterDriverFactoryActivationLevelTest, | 766 ContentSubresourceFilterDriverFactoryActivationLevelTest, |
767 ::testing::ValuesIn(kActivationLevelTestData)); | 767 ::testing::ValuesIn(kActivationLevelTestData)); |
768 | 768 |
769 } // namespace subresource_filter | 769 } // namespace subresource_filter |
OLD | NEW |