Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Side by Side Diff: chrome/browser/extensions/process_manager_browsertest.cc

Issue 2461693002: Change Isolate Extensions to be off by default. (Closed)
Patch Set: Fix tests which fail without Isolate Extensions. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 EXPECT_TRUE(content::NavigateIframeToURL(tab, "frame1", extension_url)); 706 EXPECT_TRUE(content::NavigateIframeToURL(tab, "frame1", extension_url));
707 EXPECT_EQ(IfExtensionsIsolated(1, 0), 707 EXPECT_EQ(IfExtensionsIsolated(1, 0),
708 pm->GetRenderFrameHostsForExtension(extension->id()).size()); 708 pm->GetRenderFrameHostsForExtension(extension->id()).size());
709 EXPECT_EQ(IfExtensionsIsolated(1, 0), pm->GetAllFrames().size()); 709 EXPECT_EQ(IfExtensionsIsolated(1, 0), pm->GetAllFrames().size());
710 710
711 content::RenderFrameHost* main_frame = tab->GetMainFrame(); 711 content::RenderFrameHost* main_frame = tab->GetMainFrame();
712 content::RenderFrameHost* extension_frame = ChildFrameAt(main_frame, 0); 712 content::RenderFrameHost* extension_frame = ChildFrameAt(main_frame, 0);
713 713
714 // Validate that permissions have been granted for the extension scheme 714 // Validate that permissions have been granted for the extension scheme
715 // to the process of the extension iframe. 715 // to the process of the extension iframe.
716 content::ChildProcessSecurityPolicy* policy = 716 // Note: this is only valid when --isolate-extensions is enabled.
ncarter (slow) 2016/10/28 21:49:53 Omit this comment, for cleaner merges.
nasko 2016/10/29 17:02:41 Done.
717 content::ChildProcessSecurityPolicy::GetInstance(); 717 if (extensions::IsIsolateExtensionsEnabled()) {
nasko 2016/10/28 21:18:42 All of the following checks were added as part of
ncarter (slow) 2016/10/28 21:49:53 In the branches, "if (extensions::IsIsolateExtensi
Charlie Reis 2016/10/28 23:46:33 +1 to matching Alex's https://codereview.chromium.
nasko 2016/10/29 17:02:41 Done.
718 EXPECT_TRUE(policy->CanRequestURL( 718 content::ChildProcessSecurityPolicy* policy =
719 extension_frame->GetProcess()->GetID(), 719 content::ChildProcessSecurityPolicy::GetInstance();
720 GURL("blob:chrome-extension://some-extension-id/some-guid"))); 720 EXPECT_TRUE(policy->CanRequestURL(
721 EXPECT_TRUE(policy->CanRequestURL( 721 extension_frame->GetProcess()->GetID(),
722 main_frame->GetProcess()->GetID(), 722 GURL("blob:chrome-extension://some-extension-id/some-guid")));
723 GURL("blob:chrome-extension://some-extension-id/some-guid"))); 723 EXPECT_TRUE(policy->CanRequestURL(
724 EXPECT_TRUE(policy->CanRequestURL( 724 main_frame->GetProcess()->GetID(),
725 extension_frame->GetProcess()->GetID(), 725 GURL("blob:chrome-extension://some-extension-id/some-guid")));
726 GURL("filesystem:chrome-extension://some-extension-id/some-path"))); 726 EXPECT_TRUE(policy->CanRequestURL(
727 EXPECT_TRUE(policy->CanRequestURL( 727 extension_frame->GetProcess()->GetID(),
728 main_frame->GetProcess()->GetID(), 728 GURL("filesystem:chrome-extension://some-extension-id/some-path")));
729 GURL("filesystem:chrome-extension://some-extension-id/some-path"))); 729 EXPECT_TRUE(policy->CanRequestURL(
730 EXPECT_TRUE(policy->CanRequestURL( 730 main_frame->GetProcess()->GetID(),
731 extension_frame->GetProcess()->GetID(), 731 GURL("filesystem:chrome-extension://some-extension-id/some-path")));
732 GURL("chrome-extension://some-extension-id/resource.html"))); 732 EXPECT_TRUE(policy->CanRequestURL(
733 EXPECT_TRUE(policy->CanRequestURL( 733 extension_frame->GetProcess()->GetID(),
734 main_frame->GetProcess()->GetID(), 734 GURL("chrome-extension://some-extension-id/resource.html")));
735 GURL("chrome-extension://some-extension-id/resource.html"))); 735 EXPECT_TRUE(policy->CanRequestURL(
736 main_frame->GetProcess()->GetID(),
737 GURL("chrome-extension://some-extension-id/resource.html")));
736 738
737 EXPECT_TRUE(policy->CanCommitURL( 739 EXPECT_TRUE(policy->CanCommitURL(
738 extension_frame->GetProcess()->GetID(), 740 extension_frame->GetProcess()->GetID(),
739 GURL("blob:chrome-extension://some-extension-id/some-guid"))); 741 GURL("blob:chrome-extension://some-extension-id/some-guid")));
740 EXPECT_FALSE(policy->CanCommitURL( 742 EXPECT_FALSE(policy->CanCommitURL(
741 main_frame->GetProcess()->GetID(), 743 main_frame->GetProcess()->GetID(),
742 GURL("blob:chrome-extension://some-extension-id/some-guid"))); 744 GURL("blob:chrome-extension://some-extension-id/some-guid")));
743 EXPECT_TRUE(policy->CanCommitURL( 745 EXPECT_TRUE(policy->CanCommitURL(
744 extension_frame->GetProcess()->GetID(), 746 extension_frame->GetProcess()->GetID(),
745 GURL("chrome-extension://some-extension-id/resource.html"))); 747 GURL("chrome-extension://some-extension-id/resource.html")));
746 EXPECT_FALSE(policy->CanCommitURL( 748 EXPECT_FALSE(policy->CanCommitURL(
747 main_frame->GetProcess()->GetID(), 749 main_frame->GetProcess()->GetID(),
748 GURL("chrome-extension://some-extension-id/resource.html"))); 750 GURL("chrome-extension://some-extension-id/resource.html")));
749 EXPECT_TRUE(policy->CanCommitURL( 751 EXPECT_TRUE(policy->CanCommitURL(
750 extension_frame->GetProcess()->GetID(), 752 extension_frame->GetProcess()->GetID(),
751 GURL("filesystem:chrome-extension://some-extension-id/some-path"))); 753 GURL("filesystem:chrome-extension://some-extension-id/some-path")));
752 EXPECT_FALSE(policy->CanCommitURL( 754 EXPECT_FALSE(policy->CanCommitURL(
753 main_frame->GetProcess()->GetID(), 755 main_frame->GetProcess()->GetID(),
754 GURL("filesystem:chrome-extension://some-extension-id/some-path"))); 756 GURL("filesystem:chrome-extension://some-extension-id/some-path")));
757 }
755 758
756 // Open a new about:blank popup from main frame. This should stay in the web 759 // Open a new about:blank popup from main frame. This should stay in the web
757 // process. 760 // process.
758 content::WebContents* popup = 761 content::WebContents* popup =
759 OpenPopup(main_frame, GURL(url::kAboutBlankURL)); 762 OpenPopup(main_frame, GURL(url::kAboutBlankURL));
760 EXPECT_NE(popup, tab); 763 EXPECT_NE(popup, tab);
761 ASSERT_EQ(2, browser()->tab_strip_model()->count()); 764 ASSERT_EQ(2, browser()->tab_strip_model()->count());
762 EXPECT_EQ(IfExtensionsIsolated(1, 0), 765 EXPECT_EQ(IfExtensionsIsolated(1, 0),
763 pm->GetRenderFrameHostsForExtension(extension->id()).size()); 766 pm->GetRenderFrameHostsForExtension(extension->id()).size());
764 EXPECT_EQ(IfExtensionsIsolated(1, 0), pm->GetAllFrames().size()); 767 EXPECT_EQ(IfExtensionsIsolated(1, 0), pm->GetAllFrames().size());
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 EXPECT_TRUE(ExecuteScriptAndExtractBool( 1064 EXPECT_TRUE(ExecuteScriptAndExtractBool(
1062 popup, "window.domAutomationController.send(!!window.opener)", 1065 popup, "window.domAutomationController.send(!!window.opener)",
1063 &is_opener_defined)); 1066 &is_opener_defined));
1064 EXPECT_TRUE(is_opener_defined); 1067 EXPECT_TRUE(is_opener_defined);
1065 1068
1066 // Verify that postMessage to window.opener works. 1069 // Verify that postMessage to window.opener works.
1067 VerifyPostMessageToOpener(popup->GetMainFrame(), extension_frame); 1070 VerifyPostMessageToOpener(popup->GetMainFrame(), extension_frame);
1068 } 1071 }
1069 1072
1070 } // namespace extensions 1073 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698