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 10265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10276 embedded_test_server()->GetURL("b.com", "/feature-policy2.html")); | 10276 embedded_test_server()->GetURL("b.com", "/feature-policy2.html")); |
10277 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 10277 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
10278 | 10278 |
10279 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); | 10279 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
10280 | 10280 |
10281 // Validate that the effective container policy contains a single non-unique | 10281 // Validate that the effective container policy contains a single non-unique |
10282 // origin. | 10282 // origin. |
10283 const ParsedFeaturePolicyHeader initial_effective_policy = | 10283 const ParsedFeaturePolicyHeader initial_effective_policy = |
10284 root->child_at(2)->effective_container_policy(); | 10284 root->child_at(2)->effective_container_policy(); |
10285 EXPECT_EQ(1UL, initial_effective_policy[0].origins.size()); | 10285 EXPECT_EQ(1UL, initial_effective_policy[0].origins.size()); |
10286 EXPECT_FALSE(initial_effective_policy[0].origins[0].unique()); | 10286 EXPECT_FALSE(initial_effective_policy[0].origins[0].opaque()); |
10287 | 10287 |
10288 // Set the "sandbox" attribute; pending policy should update, and should now | 10288 // Set the "sandbox" attribute; pending policy should update, and should now |
10289 // contain a unique origin, but effective policy should remain unchanged. | 10289 // contain a unique origin, but effective policy should remain unchanged. |
10290 EXPECT_TRUE(ExecuteScript( | 10290 EXPECT_TRUE(ExecuteScript( |
10291 root, "document.getElementById('child-2').setAttribute('sandbox','')")); | 10291 root, "document.getElementById('child-2').setAttribute('sandbox','')")); |
10292 const ParsedFeaturePolicyHeader updated_effective_policy = | 10292 const ParsedFeaturePolicyHeader updated_effective_policy = |
10293 root->child_at(2)->effective_container_policy(); | 10293 root->child_at(2)->effective_container_policy(); |
10294 const ParsedFeaturePolicyHeader updated_pending_policy = | 10294 const ParsedFeaturePolicyHeader updated_pending_policy = |
10295 root->child_at(2)->pending_container_policy_; | 10295 root->child_at(2)->pending_container_policy_; |
10296 EXPECT_EQ(1UL, updated_effective_policy[0].origins.size()); | 10296 EXPECT_EQ(1UL, updated_effective_policy[0].origins.size()); |
10297 EXPECT_FALSE(updated_effective_policy[0].origins[0].unique()); | 10297 EXPECT_FALSE(updated_effective_policy[0].origins[0].opaque()); |
10298 EXPECT_EQ(1UL, updated_pending_policy[0].origins.size()); | 10298 EXPECT_EQ(1UL, updated_pending_policy[0].origins.size()); |
10299 EXPECT_TRUE(updated_pending_policy[0].origins[0].unique()); | 10299 EXPECT_TRUE(updated_pending_policy[0].origins[0].opaque()); |
10300 | 10300 |
10301 // Navigate the frame; pending policy should now be committed. | 10301 // Navigate the frame; pending policy should now be committed. |
10302 NavigateFrameToURL(root->child_at(2), nav_url); | 10302 NavigateFrameToURL(root->child_at(2), nav_url); |
10303 const ParsedFeaturePolicyHeader final_effective_policy = | 10303 const ParsedFeaturePolicyHeader final_effective_policy = |
10304 root->child_at(2)->effective_container_policy(); | 10304 root->child_at(2)->effective_container_policy(); |
10305 EXPECT_EQ(1UL, final_effective_policy[0].origins.size()); | 10305 EXPECT_EQ(1UL, final_effective_policy[0].origins.size()); |
10306 EXPECT_TRUE(final_effective_policy[0].origins[0].unique()); | 10306 EXPECT_TRUE(final_effective_policy[0].origins[0].opaque()); |
10307 } | 10307 } |
10308 | 10308 |
10309 // Test harness that allows for "barrier" style delaying of requests matching | 10309 // Test harness that allows for "barrier" style delaying of requests matching |
10310 // certain paths. Call SetDelayedRequestsForPath to delay requests, then | 10310 // certain paths. Call SetDelayedRequestsForPath to delay requests, then |
10311 // SetUpEmbeddedTestServer to register handlers and start the server. | 10311 // SetUpEmbeddedTestServer to register handlers and start the server. |
10312 class RequestDelayingSitePerProcessBrowserTest | 10312 class RequestDelayingSitePerProcessBrowserTest |
10313 : public SitePerProcessBrowserTest { | 10313 : public SitePerProcessBrowserTest { |
10314 public: | 10314 public: |
10315 RequestDelayingSitePerProcessBrowserTest() | 10315 RequestDelayingSitePerProcessBrowserTest() |
10316 : test_server_(base::MakeUnique<net::EmbeddedTestServer>()) {} | 10316 : test_server_(base::MakeUnique<net::EmbeddedTestServer>()) {} |
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11373 SimpleTap(gfx::Point(point_outside_iframe.x(), point_outside_iframe.y())); | 11373 SimpleTap(gfx::Point(point_outside_iframe.x(), point_outside_iframe.y())); |
11374 selection_controller_client->Wait(); | 11374 selection_controller_client->Wait(); |
11375 | 11375 |
11376 EXPECT_EQ(ui::TouchSelectionController::INACTIVE, | 11376 EXPECT_EQ(ui::TouchSelectionController::INACTIVE, |
11377 parent_view->touch_selection_controller()->active_status()); | 11377 parent_view->touch_selection_controller()->active_status()); |
11378 } | 11378 } |
11379 | 11379 |
11380 #endif // defined(OS_ANDROID) | 11380 #endif // defined(OS_ANDROID) |
11381 | 11381 |
11382 } // namespace content | 11382 } // namespace content |
OLD | NEW |