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

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

Issue 1411073005: Migrating tests to use EmbeddedTestServer (/content) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 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 (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"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 // The goal of these tests will be to "simulate" exploited renderer processes, 124 // The goal of these tests will be to "simulate" exploited renderer processes,
125 // which can send arbitrary IPC messages and confuse browser process internal 125 // which can send arbitrary IPC messages and confuse browser process internal
126 // state, leading to security bugs. We are trying to verify that the browser 126 // state, leading to security bugs. We are trying to verify that the browser
127 // doesn't perform any dangerous operations in such cases. 127 // doesn't perform any dangerous operations in such cases.
128 class SecurityExploitBrowserTest : public ContentBrowserTest { 128 class SecurityExploitBrowserTest : public ContentBrowserTest {
129 public: 129 public:
130 SecurityExploitBrowserTest() {} 130 SecurityExploitBrowserTest() {}
131 131
132 void SetUpCommandLine(base::CommandLine* command_line) override { 132 void SetUpCommandLine(base::CommandLine* command_line) override {
133 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 133 ASSERT_TRUE(embedded_test_server()->Start());
134 134
135 // Add a host resolver rule to map all outgoing requests to the test server. 135 // Add a host resolver rule to map all outgoing requests to the test server.
136 // This allows us to use "real" hostnames in URLs, which we can use to 136 // This allows us to use "real" hostnames in URLs, which we can use to
137 // create arbitrary SiteInstances. 137 // create arbitrary SiteInstances.
138 command_line->AppendSwitchASCII( 138 command_line->AppendSwitchASCII(
139 switches::kHostResolverRules, 139 switches::kHostResolverRules,
140 "MAP * " + 140 "MAP * " +
141 net::HostPortPair::FromURL(embedded_test_server()->base_url()) 141 net::HostPortPair::FromURL(embedded_test_server()->base_url())
142 .ToString() + 142 .ToString() +
143 ",EXCLUDE localhost"); 143 ",EXCLUDE localhost");
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); 429 RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
430 IPC::IpcSecurityTestUtil::PwnMessageReceived( 430 IPC::IpcSecurityTestUtil::PwnMessageReceived(
431 web_rfh->GetProcess()->GetChannel(), 431 web_rfh->GetProcess()->GetChannel(),
432 ResourceHostMsg_RequestResource(web_rfh->GetRoutingID(), 1, 432 ResourceHostMsg_RequestResource(web_rfh->GetRoutingID(), 1,
433 invalid_scheme_origin_msg)); 433 invalid_scheme_origin_msg));
434 web_process_killed.Wait(); 434 web_process_killed.Wait();
435 } 435 }
436 } 436 }
437 437
438 } // namespace content 438 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698