OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/site_per_process_browsertest.h" | 5 #include "content/browser/site_per_process_browsertest.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
551 } | 551 } |
552 | 552 |
553 void SitePerProcessBrowserTest::SetUpCommandLine( | 553 void SitePerProcessBrowserTest::SetUpCommandLine( |
554 base::CommandLine* command_line) { | 554 base::CommandLine* command_line) { |
555 IsolateAllSitesForTesting(command_line); | 555 IsolateAllSitesForTesting(command_line); |
556 #if !defined(OS_ANDROID) | 556 #if !defined(OS_ANDROID) |
557 // TODO(bokan): Needed for scrollability check in | 557 // TODO(bokan): Needed for scrollability check in |
558 // FrameOwnerPropertiesPropagationScrolling. crbug.com/662196. | 558 // FrameOwnerPropertiesPropagationScrolling. crbug.com/662196. |
559 command_line->AppendSwitch(switches::kDisableOverlayScrollbar); | 559 command_line->AppendSwitch(switches::kDisableOverlayScrollbar); |
560 #endif | 560 #endif |
561 command_line->AppendSwitchASCII(switches::kEnableBlinkFeatures, | |
alexmos
2016/11/17 21:45:59
Do you mind splitting this out into a new subclass
iclelland
2016/11/18 16:12:37
That's a good idea, I hadn't seen that -- thanks.
| |
562 "FeaturePolicy"); | |
561 }; | 563 }; |
562 | 564 |
563 void SitePerProcessBrowserTest::SetUpOnMainThread() { | 565 void SitePerProcessBrowserTest::SetUpOnMainThread() { |
564 host_resolver()->AddRule("*", "127.0.0.1"); | 566 host_resolver()->AddRule("*", "127.0.0.1"); |
565 ASSERT_TRUE(embedded_test_server()->Start()); | 567 ASSERT_TRUE(embedded_test_server()->Start()); |
566 SetupCrossSiteRedirector(embedded_test_server()); | 568 SetupCrossSiteRedirector(embedded_test_server()); |
567 } | 569 } |
568 | 570 |
569 // | 571 // |
570 // SitePerProcessHighDPIBrowserTest | 572 // SitePerProcessHighDPIBrowserTest |
(...skipping 7984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8555 // |popup2|. This is allowed since the main tab is |popup2|'s opener. | 8557 // |popup2|. This is allowed since the main tab is |popup2|'s opener. |
8556 EXPECT_TRUE(NavigateToURL(shell(), b_url)); | 8558 EXPECT_TRUE(NavigateToURL(shell(), b_url)); |
8557 | 8559 |
8558 base::string16 expected_title(base::UTF8ToUTF16("foo")); | 8560 base::string16 expected_title(base::UTF8ToUTF16("foo")); |
8559 TitleWatcher title_watcher(popup2->web_contents(), expected_title); | 8561 TitleWatcher title_watcher(popup2->web_contents(), expected_title); |
8560 EXPECT_TRUE(ExecuteScript( | 8562 EXPECT_TRUE(ExecuteScript( |
8561 shell(), "window.open('','popup2').postMessage('foo', '*');")); | 8563 shell(), "window.open('','popup2').postMessage('foo', '*');")); |
8562 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 8564 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
8563 } | 8565 } |
8564 | 8566 |
8567 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | |
alexmos
2016/11/17 21:45:59
These tests provide good coverage that the browser
iclelland
2016/11/18 16:12:37
Definitely should have that. I'm bringing the layo
alexmos
2016/11/18 17:21:44
In that case I think it's fine to go with layout t
| |
8568 TestFeaturePolicyReplicationOnSameOriginNavigation) { | |
8569 GURL a_url(embedded_test_server()->GetURL("a.com", "/feature-policy1.html")); | |
8570 GURL b_url(embedded_test_server()->GetURL("a.com", "/feature-policy2.html")); | |
alexmos
2016/11/17 21:45:59
nit: b_url implies that it's at b.com (this is the
iclelland
2016/11/18 16:12:37
Done.
| |
8571 GURL c_url(embedded_test_server()->GetURL("a.com", "/title2.html")); | |
8572 | |
8573 EXPECT_TRUE(NavigateToURL(shell(), a_url)); | |
8574 | |
8575 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); | |
8576 EXPECT_EQ("{\"vibrate\":[\"self\"]}", | |
8577 root->current_replication_state().feature_policy_header); | |
8578 | |
8579 // When the main frame navigates to a page with a new policy, it should | |
8580 // overwrite the old one. | |
8581 EXPECT_TRUE(NavigateToURL(shell(), b_url)); | |
8582 EXPECT_EQ("{\"vibrate\":[\"*\"]}", | |
8583 root->current_replication_state().feature_policy_header); | |
8584 | |
8585 // When the main frame navigates to a page without a policy, the replicated | |
8586 // policy header should be cleared. | |
8587 EXPECT_TRUE(NavigateToURL(shell(), c_url)); | |
8588 EXPECT_EQ("", root->current_replication_state().feature_policy_header); | |
8589 } | |
8590 | |
8591 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | |
8592 TestFeaturePolicyReplicationOnCrossOriginNavigation) { | |
8593 GURL a_url(embedded_test_server()->GetURL("a.com", "/feature-policy1.html")); | |
8594 GURL b_url(embedded_test_server()->GetURL("b.com", "/feature-policy2.html")); | |
8595 GURL c_url(embedded_test_server()->GetURL("c.com", "/title2.html")); | |
8596 | |
8597 EXPECT_TRUE(NavigateToURL(shell(), a_url)); | |
8598 | |
8599 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); | |
8600 EXPECT_EQ("{\"vibrate\":[\"self\"]}", | |
8601 root->current_replication_state().feature_policy_header); | |
8602 | |
8603 TestFrameNavigationObserver frame_observer(root); | |
alexmos
2016/11/17 21:45:58
This doesn't seem necessary. NavigateToURL will w
iclelland
2016/11/18 16:12:37
Removed... somehow during testing it looked like I
| |
8604 | |
8605 // When the main frame navigates to a page with a new policy, it should | |
8606 // overwrite the old one. | |
8607 EXPECT_TRUE(NavigateToURL(shell(), b_url)); | |
8608 frame_observer.WaitForCommit(); | |
8609 EXPECT_EQ("{\"vibrate\":[\"*\"]}", | |
8610 root->current_replication_state().feature_policy_header); | |
8611 | |
8612 // When the main frame navigates to a page without a policy, the replicated | |
8613 // policy header should be cleared. | |
8614 EXPECT_TRUE(NavigateToURL(shell(), c_url)); | |
8615 frame_observer.WaitForCommit(); | |
8616 EXPECT_EQ("", root->current_replication_state().feature_policy_header); | |
8617 } | |
8618 | |
8565 } // namespace content | 8619 } // namespace content |
OLD | NEW |