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 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
745 | 745 |
746 ParsedFeaturePolicyHeader CreateFPHeaderMatchesAll( | 746 ParsedFeaturePolicyHeader CreateFPHeaderMatchesAll( |
747 blink::WebFeaturePolicyFeature feature) { | 747 blink::WebFeaturePolicyFeature feature) { |
748 ParsedFeaturePolicyHeader result(1); | 748 ParsedFeaturePolicyHeader result(1); |
749 result[0].feature = feature; | 749 result[0].feature = feature; |
750 result[0].matches_all_origins = true; | 750 result[0].matches_all_origins = true; |
751 return result; | 751 return result; |
752 } | 752 } |
753 }; | 753 }; |
754 | 754 |
755 // SitePerProcessFeaturePolicyDisabledBrowserTest | |
756 | |
757 class SitePerProcessFeaturePolicyDisabledBrowserTest | |
758 : public SitePerProcessBrowserTest { | |
759 public: | |
760 SitePerProcessFeaturePolicyDisabledBrowserTest() {} | |
761 | |
762 protected: | |
763 void SetUpCommandLine(base::CommandLine* command_line) override { | |
764 SitePerProcessBrowserTest::SetUpCommandLine(command_line); | |
765 command_line->AppendSwitchASCII(switches::kDisableBlinkFeatures, | |
766 "FeaturePolicy"); | |
767 } | |
768 }; | |
769 | |
755 IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest, | 770 IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest, |
756 SubframeLoadsWithCorrectDeviceScaleFactor) { | 771 SubframeLoadsWithCorrectDeviceScaleFactor) { |
757 GURL main_url(embedded_test_server()->GetURL( | 772 GURL main_url(embedded_test_server()->GetURL( |
758 "a.com", "/cross_site_iframe_factory.html?a(b)")); | 773 "a.com", "/cross_site_iframe_factory.html?a(b)")); |
759 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 774 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
760 | 775 |
761 // On Android forcing device scale factor does not work for tests, therefore | 776 // On Android forcing device scale factor does not work for tests, therefore |
762 // we ensure that make frame and iframe have the same DIP scale there, but | 777 // we ensure that make frame and iframe have the same DIP scale there, but |
763 // not necessarily kDeviceScaleFactor. | 778 // not necessarily kDeviceScaleFactor. |
764 const double expected_dip_scale = | 779 const double expected_dip_scale = |
(...skipping 8130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8895 EXPECT_FALSE(base::ContainsKey( | 8910 EXPECT_FALSE(base::ContainsKey( |
8896 web_contents()->pending_widget_views_, | 8911 web_contents()->pending_widget_views_, |
8897 std::make_pair(process1->GetID(), filter1->routing_id()))); | 8912 std::make_pair(process1->GetID(), filter1->routing_id()))); |
8898 EXPECT_FALSE(base::ContainsKey( | 8913 EXPECT_FALSE(base::ContainsKey( |
8899 web_contents()->pending_widget_views_, | 8914 web_contents()->pending_widget_views_, |
8900 std::make_pair(process2->GetID(), filter2->routing_id()))); | 8915 std::make_pair(process2->GetID(), filter2->routing_id()))); |
8901 } | 8916 } |
8902 #endif | 8917 #endif |
8903 | 8918 |
8904 // Check that out-of-process frames correctly calculate their ability to enter | 8919 // Check that out-of-process frames correctly calculate their ability to enter |
8905 // fullscreen. A frame is allowed enter fullscreen if the allowFullscreen | 8920 // fullscreen when Feature Policy is disabled. A frame is allowed to enter |
8906 // attribute is present in all of its ancestor <iframe> elements. For OOPIF, | 8921 // fullscreen if the allowFullscreen attribute is present in all of its ancestor |
8907 // when a parent frame changes this attribute, the change is replicated to the | 8922 // <iframe> elements. For OOPIF, when a parent frame changes this attribute, |
8908 // child frame and its proxies. | 8923 // the change is replicated to the child frame and its proxies. |
alexmos
2017/08/16 22:12:16
It might be useful to say explicitly that this is
iclelland
2017/08/17 20:01:56
There are two changes that could break tests -- th
| |
8909 // | 8924 // |
8910 // The test checks the following cases: | 8925 // The test checks the following cases: |
8911 // | 8926 // |
8912 // 1. Static attribute (<iframe allowfullscreen>) | 8927 // 1. Static attribute (<iframe allowfullscreen>) |
8913 // 2. Attribute injected dynamically via JavaScript | 8928 // 2. Attribute injected dynamically via JavaScript |
8914 // 3. Multiple levels of nesting (A-embed-B-embed-C) | 8929 // 3. Multiple levels of nesting (A-embed-B-embed-C) |
8915 // 4. Cross-site subframe navigation | 8930 // 4. Cross-site subframe navigation |
8916 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, AllowFullscreen) { | 8931 IN_PROC_BROWSER_TEST_F(SitePerProcessFeaturePolicyDisabledBrowserTest, |
8932 AllowFullscreen) { | |
8917 // Load a page with a cross-site <iframe allowFullscreen>. | 8933 // Load a page with a cross-site <iframe allowFullscreen>. |
8918 GURL url_1(embedded_test_server()->GetURL( | 8934 GURL url_1(embedded_test_server()->GetURL( |
8919 "a.com", "/page_with_allowfullscreen_frame.html")); | 8935 "a.com", "/page_with_allowfullscreen_frame.html")); |
8920 EXPECT_TRUE(NavigateToURL(shell(), url_1)); | 8936 EXPECT_TRUE(NavigateToURL(shell(), url_1)); |
8921 | 8937 |
8922 WebContentsImpl* contents = web_contents(); | 8938 WebContentsImpl* contents = web_contents(); |
8923 FrameTreeNode* root = contents->GetFrameTree()->root(); | 8939 FrameTreeNode* root = contents->GetFrameTree()->root(); |
8924 | 8940 |
8925 // Helper to check if a frame is allowed to go fullscreen on the renderer | 8941 // Helper to check if a frame is allowed to go fullscreen on the renderer |
8926 // side. | 8942 // side. |
(...skipping 2353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11280 SimpleTap(gfx::Point(point_outside_iframe.x(), point_outside_iframe.y())); | 11296 SimpleTap(gfx::Point(point_outside_iframe.x(), point_outside_iframe.y())); |
11281 selection_controller_client->Wait(); | 11297 selection_controller_client->Wait(); |
11282 | 11298 |
11283 EXPECT_EQ(ui::TouchSelectionController::INACTIVE, | 11299 EXPECT_EQ(ui::TouchSelectionController::INACTIVE, |
11284 parent_view->touch_selection_controller()->active_status()); | 11300 parent_view->touch_selection_controller()->active_status()); |
11285 } | 11301 } |
11286 | 11302 |
11287 #endif // defined(OS_ANDROID) | 11303 #endif // defined(OS_ANDROID) |
11288 | 11304 |
11289 } // namespace content | 11305 } // namespace content |
OLD | NEW |