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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
740 | 740 |
741 ParsedFeaturePolicyHeader CreateFPHeaderMatchesAll( | 741 ParsedFeaturePolicyHeader CreateFPHeaderMatchesAll( |
742 blink::WebFeaturePolicyFeature feature) { | 742 blink::WebFeaturePolicyFeature feature) { |
743 ParsedFeaturePolicyHeader result(1); | 743 ParsedFeaturePolicyHeader result(1); |
744 result[0].feature = feature; | 744 result[0].feature = feature; |
745 result[0].matches_all_origins = true; | 745 result[0].matches_all_origins = true; |
746 return result; | 746 return result; |
747 } | 747 } |
748 }; | 748 }; |
749 | 749 |
750 // SitePerProcessFeaturePolicyDisabledBrowserTest | |
751 | |
752 class SitePerProcessFeaturePolicyDisabledBrowserTest | |
753 : public SitePerProcessBrowserTest { | |
754 public: | |
755 SitePerProcessFeaturePolicyDisabledBrowserTest() {} | |
756 | |
757 protected: | |
758 void SetUpCommandLine(base::CommandLine* command_line) override { | |
759 SitePerProcessBrowserTest::SetUpCommandLine(command_line); | |
760 command_line->AppendSwitchASCII(switches::kDisableBlinkFeatures, | |
761 "FeaturePolicy"); | |
762 } | |
763 }; | |
764 | |
750 IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest, | 765 IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest, |
751 SubframeLoadsWithCorrectDeviceScaleFactor) { | 766 SubframeLoadsWithCorrectDeviceScaleFactor) { |
752 GURL main_url(embedded_test_server()->GetURL( | 767 GURL main_url(embedded_test_server()->GetURL( |
753 "a.com", "/cross_site_iframe_factory.html?a(b)")); | 768 "a.com", "/cross_site_iframe_factory.html?a(b)")); |
754 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 769 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
755 | 770 |
756 // On Android forcing device scale factor does not work for tests, therefore | 771 // On Android forcing device scale factor does not work for tests, therefore |
757 // we ensure that make frame and iframe have the same DIP scale there, but | 772 // we ensure that make frame and iframe have the same DIP scale there, but |
758 // not necessarily kDeviceScaleFactor. | 773 // not necessarily kDeviceScaleFactor. |
759 const double expected_dip_scale = | 774 const double expected_dip_scale = |
(...skipping 7929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8689 EXPECT_FALSE(base::ContainsKey( | 8704 EXPECT_FALSE(base::ContainsKey( |
8690 web_contents()->pending_widget_views_, | 8705 web_contents()->pending_widget_views_, |
8691 std::make_pair(process1->GetID(), filter1->routing_id()))); | 8706 std::make_pair(process1->GetID(), filter1->routing_id()))); |
8692 EXPECT_FALSE(base::ContainsKey( | 8707 EXPECT_FALSE(base::ContainsKey( |
8693 web_contents()->pending_widget_views_, | 8708 web_contents()->pending_widget_views_, |
8694 std::make_pair(process2->GetID(), filter2->routing_id()))); | 8709 std::make_pair(process2->GetID(), filter2->routing_id()))); |
8695 } | 8710 } |
8696 #endif | 8711 #endif |
8697 | 8712 |
8698 // Check that out-of-process frames correctly calculate their ability to enter | 8713 // Check that out-of-process frames correctly calculate their ability to enter |
8699 // fullscreen. A frame is allowed enter fullscreen if the allowFullscreen | 8714 // fullscreen when Feature Policy is disabled. A frame is allowed to enter |
8700 // attribute is present in all of its ancestor <iframe> elements. For OOPIF, | 8715 // fullscreen if the allowFullscreen attribute is present in all of its ancestor |
loonybear
2017/08/08 17:55:53
Just to clarify, a frame is allowed to enter fulls
iclelland
2017/08/08 20:14:26
That's correct; that's the original behaviour of a
| |
8701 // when a parent frame changes this attribute, the change is replicated to the | 8716 // <iframe> elements. For OOPIF, when a parent frame changes this attribute, |
8702 // child frame and its proxies. | 8717 // the change is replicated to the child frame and its proxies. |
8703 // | 8718 // |
8704 // The test checks the following cases: | 8719 // The test checks the following cases: |
8705 // | 8720 // |
8706 // 1. Static attribute (<iframe allowfullscreen>) | 8721 // 1. Static attribute (<iframe allowfullscreen>) |
8707 // 2. Attribute injected dynamically via JavaScript | 8722 // 2. Attribute injected dynamically via JavaScript |
8708 // 3. Multiple levels of nesting (A-embed-B-embed-C) | 8723 // 3. Multiple levels of nesting (A-embed-B-embed-C) |
8709 // 4. Cross-site subframe navigation | 8724 // 4. Cross-site subframe navigation |
8710 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, AllowFullscreen) { | 8725 IN_PROC_BROWSER_TEST_F(SitePerProcessFeaturePolicyDisabledBrowserTest, |
8726 AllowFullscreen) { | |
8711 // Load a page with a cross-site <iframe allowFullscreen>. | 8727 // Load a page with a cross-site <iframe allowFullscreen>. |
8712 GURL url_1(embedded_test_server()->GetURL( | 8728 GURL url_1(embedded_test_server()->GetURL( |
8713 "a.com", "/page_with_allowfullscreen_frame.html")); | 8729 "a.com", "/page_with_allowfullscreen_frame.html")); |
8714 EXPECT_TRUE(NavigateToURL(shell(), url_1)); | 8730 EXPECT_TRUE(NavigateToURL(shell(), url_1)); |
8715 | 8731 |
8716 WebContentsImpl* contents = web_contents(); | 8732 WebContentsImpl* contents = web_contents(); |
8717 FrameTreeNode* root = contents->GetFrameTree()->root(); | 8733 FrameTreeNode* root = contents->GetFrameTree()->root(); |
8718 | 8734 |
8719 // Helper to check if a frame is allowed to go fullscreen on the renderer | 8735 // Helper to check if a frame is allowed to go fullscreen on the renderer |
8720 // side. | 8736 // side. |
(...skipping 2421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11142 SimpleTap(gfx::Point(point_outside_iframe.x(), point_outside_iframe.y())); | 11158 SimpleTap(gfx::Point(point_outside_iframe.x(), point_outside_iframe.y())); |
11143 selection_controller_client->Wait(); | 11159 selection_controller_client->Wait(); |
11144 | 11160 |
11145 EXPECT_EQ(ui::TouchSelectionController::INACTIVE, | 11161 EXPECT_EQ(ui::TouchSelectionController::INACTIVE, |
11146 parent_view->touch_selection_controller()->active_status()); | 11162 parent_view->touch_selection_controller()->active_status()); |
11147 } | 11163 } |
11148 | 11164 |
11149 #endif // defined(OS_ANDROID) | 11165 #endif // defined(OS_ANDROID) |
11150 | 11166 |
11151 } // namespace content | 11167 } // namespace content |
OLD | NEW |