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

Side by Side Diff: content/browser/security_exploit_browsertest.cc

Issue 1470823002: Enable builtin Mojo JS modules in layout tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@usb-testing
Patch Set: self review Created 5 years 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/containers/hash_tables.h" 6 #include "base/containers/hash_tables.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" 8 #include "content/browser/dom_storage/dom_storage_context_wrapper.h"
9 #include "content/browser/dom_storage/session_storage_namespace_impl.h" 9 #include "content/browser/dom_storage/session_storage_namespace_impl.h"
10 #include "content/browser/frame_host/navigator.h" 10 #include "content/browser/frame_host/navigator.h"
11 #include "content/browser/frame_host/render_frame_host_impl.h" 11 #include "content/browser/frame_host/render_frame_host_impl.h"
12 #include "content/browser/renderer_host/render_view_host_factory.h" 12 #include "content/browser/renderer_host/render_view_host_factory.h"
13 #include "content/browser/renderer_host/render_view_host_impl.h" 13 #include "content/browser/renderer_host/render_view_host_impl.h"
14 #include "content/browser/web_contents/web_contents_impl.h" 14 #include "content/browser/web_contents/web_contents_impl.h"
15 #include "content/common/frame_messages.h" 15 #include "content/common/frame_messages.h"
16 #include "content/common/resource_messages.h" 16 #include "content/common/resource_messages.h"
17 #include "content/common/view_messages.h" 17 #include "content/common/view_messages.h"
18 #include "content/public/browser/browser_context.h" 18 #include "content/public/browser/browser_context.h"
19 #include "content/public/browser/content_browser_client.h" 19 #include "content/public/browser/content_browser_client.h"
20 #include "content/public/browser/interstitial_page.h" 20 #include "content/public/browser/interstitial_page.h"
21 #include "content/public/browser/interstitial_page_delegate.h" 21 #include "content/public/browser/interstitial_page_delegate.h"
22 #include "content/public/browser/storage_partition.h" 22 #include "content/public/browser/storage_partition.h"
23 #include "content/public/common/appcache_info.h" 23 #include "content/public/common/appcache_info.h"
24 #include "content/public/common/bindings_policy.h"
24 #include "content/public/common/content_switches.h" 25 #include "content/public/common/content_switches.h"
25 #include "content/public/common/file_chooser_params.h" 26 #include "content/public/common/file_chooser_params.h"
26 #include "content/public/test/browser_test_utils.h" 27 #include "content/public/test/browser_test_utils.h"
27 #include "content/public/test/content_browser_test.h" 28 #include "content/public/test/content_browser_test.h"
28 #include "content/public/test/content_browser_test_utils.h" 29 #include "content/public/test/content_browser_test_utils.h"
29 #include "content/public/test/test_utils.h" 30 #include "content/public/test/test_utils.h"
30 #include "content/shell/browser/shell.h" 31 #include "content/shell/browser/shell.h"
31 #include "content/test/test_content_browser_client.h" 32 #include "content/test/test_content_browser_client.h"
32 #include "ipc/ipc_security_test_util.h" 33 #include "ipc/ipc_security_test_util.h"
33 #include "net/dns/mock_host_resolver.h" 34 #include "net/dns/mock_host_resolver.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 terminated.Wait(); 172 terminated.Wait();
172 } 173 }
173 174
174 // Ensure that we kill the renderer process if we try to give it WebUI 175 // Ensure that we kill the renderer process if we try to give it WebUI
175 // properties and it doesn't have enabled WebUI bindings. 176 // properties and it doesn't have enabled WebUI bindings.
176 IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest, SetWebUIProperty) { 177 IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest, SetWebUIProperty) {
177 GURL foo("http://foo.com/simple_page.html"); 178 GURL foo("http://foo.com/simple_page.html");
178 179
179 NavigateToURL(shell(), foo); 180 NavigateToURL(shell(), foo);
180 EXPECT_EQ(base::ASCIIToUTF16("OK"), shell()->web_contents()->GetTitle()); 181 EXPECT_EQ(base::ASCIIToUTF16("OK"), shell()->web_contents()->GetTitle());
181 EXPECT_EQ(0, 182 EXPECT_FALSE(
182 shell()->web_contents()->GetRenderViewHost()->GetEnabledBindings()); 183 shell()->web_contents()->GetRenderViewHost()->GetEnabledBindings() &
184 BINDINGS_POLICY_WEB_UI);
183 185
184 RenderProcessHostWatcher terminated( 186 RenderProcessHostWatcher terminated(
185 shell()->web_contents(), 187 shell()->web_contents(),
186 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); 188 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
187 shell()->web_contents()->GetRenderViewHost()->SetWebUIProperty( 189 shell()->web_contents()->GetRenderViewHost()->SetWebUIProperty(
188 "toolkit", "views"); 190 "toolkit", "views");
189 terminated.Wait(); 191 terminated.Wait();
190 } 192 }
191 193
192 // This is a test for crbug.com/312016 attempting to create duplicate 194 // This is a test for crbug.com/312016 attempting to create duplicate
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); 431 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
430 IPC::IpcSecurityTestUtil::PwnMessageReceived( 432 IPC::IpcSecurityTestUtil::PwnMessageReceived(
431 web_rfh->GetProcess()->GetChannel(), 433 web_rfh->GetProcess()->GetChannel(),
432 ResourceHostMsg_RequestResource(web_rfh->GetRoutingID(), 1, 434 ResourceHostMsg_RequestResource(web_rfh->GetRoutingID(), 1,
433 invalid_scheme_origin_msg)); 435 invalid_scheme_origin_msg));
434 web_process_killed.Wait(); 436 web_process_killed.Wait();
435 } 437 }
436 } 438 }
437 439
438 } // namespace content 440 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698