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

Side by Side Diff: chrome/browser/chrome_security_exploit_browsertest.cc

Issue 2850793005: Remove command line/field trial support and configs for Isolate Extensions. (Closed)
Patch Set: Remove unused headers from extension_process_policy.h Created 3 years, 7 months 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/macros.h" 6 #include "base/macros.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "base/test/histogram_tester.h" 8 #include "base/test/histogram_tester.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_commands.h" 10 #include "chrome/browser/ui/browser_commands.h"
11 #include "chrome/browser/ui/singleton_tabs.h" 11 #include "chrome/browser/ui/singleton_tabs.h"
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" 12 #include "chrome/browser/ui/tabs/tab_strip_model.h"
13 #include "chrome/common/extensions/extension_process_policy.h" 13 #include "chrome/common/extensions/extension_process_policy.h"
Lei Zhang 2017/05/02 21:32:01 No longer used.
nasko 2017/05/03 04:04:19 Done.
14 #include "chrome/test/base/in_process_browser_test.h" 14 #include "chrome/test/base/in_process_browser_test.h"
15 #include "chrome/test/base/ui_test_utils.h" 15 #include "chrome/test/base/ui_test_utils.h"
16 #include "content/public/browser/notification_observer.h" 16 #include "content/public/browser/notification_observer.h"
17 #include "content/public/browser/notification_service.h" 17 #include "content/public/browser/notification_service.h"
18 #include "content/public/browser/notification_types.h" 18 #include "content/public/browser/notification_types.h"
19 #include "content/public/browser/render_frame_host.h" 19 #include "content/public/browser/render_frame_host.h"
20 #include "content/public/browser/render_process_host.h" 20 #include "content/public/browser/render_process_host.h"
21 #include "content/public/browser/resource_request_details.h" 21 #include "content/public/browser/resource_request_details.h"
22 #include "content/public/browser/web_contents_observer.h" 22 #include "content/public/browser/web_contents_observer.h"
23 #include "content/public/common/content_switches.h" 23 #include "content/public/common/content_switches.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 std::string status; 65 std::string status;
66 std::string expected_status("0"); 66 std::string expected_status("0");
67 EXPECT_TRUE(msg_queue.WaitForMessage(&status)); 67 EXPECT_TRUE(msg_queue.WaitForMessage(&status));
68 EXPECT_STREQ(status.c_str(), expected_status.c_str()); 68 EXPECT_STREQ(status.c_str(), expected_status.c_str());
69 } 69 }
70 70
71 // Extension isolation prevents a normal renderer process from being able to 71 // Extension isolation prevents a normal renderer process from being able to
72 // create a "blob:chrome-extension://" resource. 72 // create a "blob:chrome-extension://" resource.
73 IN_PROC_BROWSER_TEST_F(ChromeSecurityExploitBrowserTest, 73 IN_PROC_BROWSER_TEST_F(ChromeSecurityExploitBrowserTest,
74 CreateBlobInExtensionOrigin) { 74 CreateBlobInExtensionOrigin) {
75 // This test relies on extensions documents running in extension processes,
76 // which is guaranteed with --isolate-extensions. Without it, the checks are
77 // not enforced and this test will time out waiting for the process to be
78 // killed.
79 if (!extensions::IsIsolateExtensionsEnabled())
80 return;
81
82 ui_test_utils::NavigateToURL( 75 ui_test_utils::NavigateToURL(
83 browser(), 76 browser(),
84 embedded_test_server()->GetURL("a.root-servers.net", "/title1.html")); 77 embedded_test_server()->GetURL("a.root-servers.net", "/title1.html"));
85 78
86 content::RenderFrameHost* rfh = 79 content::RenderFrameHost* rfh =
87 browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame(); 80 browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame();
88 81
89 // All these are attacker controlled values. The UUID is arbitrary. 82 // All these are attacker controlled values. The UUID is arbitrary.
90 std::string blob_id = "2ce53a26-0409-45a3-86e5-f8fb9f5566d8"; 83 std::string blob_id = "2ce53a26-0409-45a3-86e5-f8fb9f5566d8";
91 std::string blob_type = "text/html"; 84 std::string blob_type = "text/html";
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 167
175 // Now navigate to |target_url| in a new tab. It should not contain |payload|. 168 // Now navigate to |target_url| in a new tab. It should not contain |payload|.
176 AddTabAtIndex(0, target_url, ui::PAGE_TRANSITION_TYPED); 169 AddTabAtIndex(0, target_url, ui::PAGE_TRANSITION_TYPED);
177 content::WaitForLoadStop(browser()->tab_strip_model()->GetWebContentsAt(0)); 170 content::WaitForLoadStop(browser()->tab_strip_model()->GetWebContentsAt(0));
178 rfh = browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame(); 171 rfh = browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame();
179 EXPECT_EQ(GURL(target_origin), rfh->GetSiteInstance()->GetSiteURL()); 172 EXPECT_EQ(GURL(target_origin), rfh->GetSiteInstance()->GetSiteURL());
180 std::string body; 173 std::string body;
181 EXPECT_TRUE(content::ExecuteScriptAndExtractString( 174 EXPECT_TRUE(content::ExecuteScriptAndExtractString(
182 rfh, "window.domAutomationController.send(document.body.innerText);", 175 rfh, "window.domAutomationController.send(document.body.innerText);",
183 &body)); 176 &body));
184 if (extensions::IsIsolateExtensionsEnabled()) { 177 EXPECT_EQ(
185 EXPECT_EQ( 178 "\nYour file was not found\n\n"
186 "\nYour file was not found\n\n" 179 "It may have been moved or deleted.\n"
187 "It may have been moved or deleted.\n" 180 "ERR_FILE_NOT_FOUND\n",
188 "ERR_FILE_NOT_FOUND\n", 181 body);
189 body);
190 } else {
191 // Without --isolate-extensions, the above steps must succeed, since
192 // unblessed extension frames are allowed in ordinary renderer processes.
193 EXPECT_EQ("pwned.", body);
194 }
195 } 182 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698