| Index: content/browser/site_per_process_browsertest.cc
|
| diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc
|
| index 042d920446d2535f168a18defe9fcb705cdee42d..df0447bd4da8a44c2f45dded6d7bb26c385e6d5c 100644
|
| --- a/content/browser/site_per_process_browsertest.cc
|
| +++ b/content/browser/site_per_process_browsertest.cc
|
| @@ -70,7 +70,9 @@
|
| #include "net/test/embedded_test_server/embedded_test_server.h"
|
| #include "net/test/embedded_test_server/http_request.h"
|
| #include "net/test/embedded_test_server/http_response.h"
|
| +#include "testing/gmock/include/gmock/gmock.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| +#include "third_party/WebKit/public/platform/WebFeaturePolicy.h"
|
| #include "third_party/WebKit/public/platform/WebInputEvent.h"
|
| #include "third_party/WebKit/public/platform/WebInsecureRequestPolicy.h"
|
| #include "third_party/WebKit/public/web/WebSandboxFlags.h"
|
| @@ -9190,6 +9192,62 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
|
| FrameHostMsg_ContextMenu(rfh->GetRoutingID(), ContextMenuParams()));
|
| }
|
|
|
| +// Test iframe "allow" attribute is propogated correctly, both on same-site and
|
| +// cross-site iframes.
|
| +IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, AllowedIFrames) {
|
| + GURL url(embedded_test_server()->GetURL("/allowed_frames.html"));
|
| + EXPECT_TRUE(NavigateToURL(shell(), url));
|
| +
|
| + FrameTreeNode* root = web_contents()->GetFrameTree()->root();
|
| +
|
| + EXPECT_EQ(embedded_test_server()->GetURL("bar.com", "/title1.html"),
|
| + root->child_at(0)->current_url());
|
| +
|
| + EXPECT_EQ(
|
| + root->child_at(0)->frame_owner_properties().allowed_feature_names.size(),
|
| + 2u);
|
| + EXPECT_EQ(
|
| + root->child_at(0)->frame_owner_properties().allowed_feature_names[0],
|
| + blink::WebFeaturePolicyFeature::Fullscreen);
|
| + EXPECT_EQ(
|
| + root->child_at(0)->frame_owner_properties().allowed_feature_names[1],
|
| + blink::WebFeaturePolicyFeature::Vibrate);
|
| + EXPECT_EQ(
|
| + root->child_at(1)->frame_owner_properties().allowed_feature_names.size(),
|
| + 2u);
|
| + EXPECT_EQ(
|
| + root->child_at(1)->frame_owner_properties().allowed_feature_names[0],
|
| + blink::WebFeaturePolicyFeature::Fullscreen);
|
| + EXPECT_EQ(
|
| + root->child_at(1)->frame_owner_properties().allowed_feature_names[1],
|
| + blink::WebFeaturePolicyFeature::Vibrate);
|
| +}
|
| +
|
| +// Test dynamic updates to iframe "allow" attribute are propogated correctly,
|
| +// both on same-site and cross-site iframes.
|
| +IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, AllowedIFramesDynamic) {
|
| + GURL main_url(embedded_test_server()->GetURL("/allowed_frames.html"));
|
| + EXPECT_TRUE(NavigateToURL(shell(), main_url));
|
| +
|
| + FrameTreeNode* root = web_contents()->GetFrameTree()->root();
|
| +
|
| + EXPECT_TRUE(ExecuteScript(
|
| + root, "document.getElementById('child-1').removeAttribute('allow')"));
|
| + EXPECT_TRUE(ExecuteScript(
|
| + root,
|
| + "document.getElementById('child-2').setAttribute('allow', 'payment')"));
|
| +
|
| + EXPECT_TRUE(root->child_at(0)
|
| + ->frame_owner_properties()
|
| + .allowed_feature_names.empty());
|
| + EXPECT_EQ(
|
| + root->child_at(1)->frame_owner_properties().allowed_feature_names.size(),
|
| + 1u);
|
| + EXPECT_EQ(
|
| + root->child_at(1)->frame_owner_properties().allowed_feature_names[0],
|
| + blink::WebFeaturePolicyFeature::Payment);
|
| +}
|
| +
|
| // Test harness that allows for "barrier" style delaying of requests matching
|
| // certain paths. Call SetDelayedRequestsForPath to delay requests, then
|
| // SetUpEmbeddedTestServer to register handlers and start the server.
|
|
|