| OLD | NEW |
| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 | 88 |
| 89 // The goal of these tests will be to "simulate" exploited renderer processes, | 89 // The goal of these tests will be to "simulate" exploited renderer processes, |
| 90 // which can send arbitrary IPC messages and confuse browser process internal | 90 // which can send arbitrary IPC messages and confuse browser process internal |
| 91 // state, leading to security bugs. We are trying to verify that the browser | 91 // state, leading to security bugs. We are trying to verify that the browser |
| 92 // doesn't perform any dangerous operations in such cases. | 92 // doesn't perform any dangerous operations in such cases. |
| 93 class SecurityExploitBrowserTest : public ContentBrowserTest { | 93 class SecurityExploitBrowserTest : public ContentBrowserTest { |
| 94 public: | 94 public: |
| 95 SecurityExploitBrowserTest() {} | 95 SecurityExploitBrowserTest() {} |
| 96 | 96 |
| 97 void SetUpCommandLine(CommandLine* command_line) override { | 97 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 98 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 98 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 99 | 99 |
| 100 // Add a host resolver rule to map all outgoing requests to the test server. | 100 // Add a host resolver rule to map all outgoing requests to the test server. |
| 101 // This allows us to use "real" hostnames in URLs, which we can use to | 101 // This allows us to use "real" hostnames in URLs, which we can use to |
| 102 // create arbitrary SiteInstances. | 102 // create arbitrary SiteInstances. |
| 103 command_line->AppendSwitchASCII( | 103 command_line->AppendSwitchASCII( |
| 104 switches::kHostResolverRules, | 104 switches::kHostResolverRules, |
| 105 "MAP * " + | 105 "MAP * " + |
| 106 net::HostPortPair::FromURL(embedded_test_server()->base_url()) | 106 net::HostPortPair::FromURL(embedded_test_server()->base_url()) |
| 107 .ToString() + | 107 .ToString() + |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 // "evil" message doesn't arrive in the intervening period. | 266 // "evil" message doesn't arrive in the intervening period. |
| 267 ASSERT_TRUE(content::ExecuteScript( | 267 ASSERT_TRUE(content::ExecuteScript( |
| 268 interstitial_page->GetRenderViewHostForTesting(), | 268 interstitial_page->GetRenderViewHostForTesting(), |
| 269 "window.domAutomationController.send(\"okay2\");")); | 269 "window.domAutomationController.send(\"okay2\");")); |
| 270 ASSERT_TRUE(message_queue.WaitForMessage(&message)); | 270 ASSERT_TRUE(message_queue.WaitForMessage(&message)); |
| 271 ASSERT_EQ("\"okay2\"", message); | 271 ASSERT_EQ("\"okay2\"", message); |
| 272 ASSERT_EQ("\"okay2\"", interstitial->last_command()); | 272 ASSERT_EQ("\"okay2\"", interstitial->last_command()); |
| 273 } | 273 } |
| 274 | 274 |
| 275 } // namespace content | 275 } // namespace content |
| OLD | NEW |