| 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/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_commands.h" | 9 #include "chrome/browser/ui/browser_commands.h" |
| 10 #include "chrome/browser/ui/singleton_tabs.h" | 10 #include "chrome/browser/ui/singleton_tabs.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // can send arbitrary IPC messages and confuse browser process internal state, | 23 // can send arbitrary IPC messages and confuse browser process internal state, |
| 24 // leading to security bugs. We are trying to verify that the browser doesn't | 24 // leading to security bugs. We are trying to verify that the browser doesn't |
| 25 // perform any dangerous operations in such cases. | 25 // perform any dangerous operations in such cases. |
| 26 // This is similar to the security_exploit_browsertest.cc tests, but also | 26 // This is similar to the security_exploit_browsertest.cc tests, but also |
| 27 // includes chrome/ layer concepts such as extensions. | 27 // includes chrome/ layer concepts such as extensions. |
| 28 class ChromeSecurityExploitBrowserTest : public InProcessBrowserTest { | 28 class ChromeSecurityExploitBrowserTest : public InProcessBrowserTest { |
| 29 public: | 29 public: |
| 30 ChromeSecurityExploitBrowserTest() {} | 30 ChromeSecurityExploitBrowserTest() {} |
| 31 virtual ~ChromeSecurityExploitBrowserTest() {} | 31 virtual ~ChromeSecurityExploitBrowserTest() {} |
| 32 | 32 |
| 33 virtual void SetUpCommandLine(CommandLine* command_line) override { | 33 void SetUpCommandLine(CommandLine* command_line) override { |
| 34 ASSERT_TRUE(test_server()->Start()); | 34 ASSERT_TRUE(test_server()->Start()); |
| 35 net::SpawnedTestServer https_server( | 35 net::SpawnedTestServer https_server( |
| 36 net::SpawnedTestServer::TYPE_HTTPS, | 36 net::SpawnedTestServer::TYPE_HTTPS, |
| 37 net::SpawnedTestServer::kLocalhost, | 37 net::SpawnedTestServer::kLocalhost, |
| 38 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 38 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); |
| 39 ASSERT_TRUE(https_server.Start()); | 39 ASSERT_TRUE(https_server.Start()); |
| 40 | 40 |
| 41 // Add a host resolver rule to map all outgoing requests to the test server. | 41 // Add a host resolver rule to map all outgoing requests to the test server. |
| 42 // This allows us to use "real" hostnames in URLs, which we can use to | 42 // This allows us to use "real" hostnames in URLs, which we can use to |
| 43 // create arbitrary SiteInstances. | 43 // create arbitrary SiteInstances. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 63 | 63 |
| 64 content::DOMMessageQueue msg_queue; | 64 content::DOMMessageQueue msg_queue; |
| 65 | 65 |
| 66 ui_test_utils::NavigateToURL(browser(), foo); | 66 ui_test_utils::NavigateToURL(browser(), foo); |
| 67 | 67 |
| 68 std::string status; | 68 std::string status; |
| 69 std::string expected_status("0"); | 69 std::string expected_status("0"); |
| 70 EXPECT_TRUE(msg_queue.WaitForMessage(&status)); | 70 EXPECT_TRUE(msg_queue.WaitForMessage(&status)); |
| 71 EXPECT_STREQ(status.c_str(), expected_status.c_str()); | 71 EXPECT_STREQ(status.c_str(), expected_status.c_str()); |
| 72 } | 72 } |
| OLD | NEW |