OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "content/public/common/content_switches.h" | 6 #include "content/public/common/content_switches.h" |
7 #include "content/public/test/browser_test_utils.h" | 7 #include "content/public/test/browser_test_utils.h" |
8 #include "content/public/test/content_browser_test.h" | 8 #include "content/public/test/content_browser_test.h" |
9 #include "content/public/test/content_browser_test_utils.h" | 9 #include "content/public/test/content_browser_test_utils.h" |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 | 12 |
13 // These tests simulate exploited renderer processes, which can fetch arbitrary | 13 // These tests simulate exploited renderer processes, which can fetch arbitrary |
14 // resources from other websites, not constrained by the Same Origin Policy. We | 14 // resources from other websites, not constrained by the Same Origin Policy. We |
15 // are trying to verify that the renderer cannot fetch any cross-site document | 15 // are trying to verify that the renderer cannot fetch any cross-site document |
16 // responses even when the Same Origin Policy is turned off inside the renderer. | 16 // responses even when the Same Origin Policy is turned off inside the renderer. |
17 class SiteIsolationPolicyBrowserTest : public ContentBrowserTest { | 17 class SiteIsolationPolicyBrowserTest : public ContentBrowserTest { |
18 public: | 18 public: |
19 SiteIsolationPolicyBrowserTest() {} | 19 SiteIsolationPolicyBrowserTest() {} |
20 virtual ~SiteIsolationPolicyBrowserTest() {} | 20 virtual ~SiteIsolationPolicyBrowserTest() {} |
21 | 21 |
22 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 22 virtual void SetUpCommandLine(CommandLine* command_line) override { |
23 ASSERT_TRUE(test_server()->Start()); | 23 ASSERT_TRUE(test_server()->Start()); |
24 net::SpawnedTestServer https_server( | 24 net::SpawnedTestServer https_server( |
25 net::SpawnedTestServer::TYPE_HTTPS, | 25 net::SpawnedTestServer::TYPE_HTTPS, |
26 net::SpawnedTestServer::kLocalhost, | 26 net::SpawnedTestServer::kLocalhost, |
27 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 27 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
28 ASSERT_TRUE(https_server.Start()); | 28 ASSERT_TRUE(https_server.Start()); |
29 | 29 |
30 // Add a host resolver rule to map all outgoing requests to the test server. | 30 // Add a host resolver rule to map all outgoing requests to the test server. |
31 // This allows us to use "real" hostnames in URLs, which we can use to | 31 // This allows us to use "real" hostnames in URLs, which we can use to |
32 // create arbitrary SiteInstances. | 32 // create arbitrary SiteInstances. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // <img>,<link>,<embed>, etc. Since the requested document is blocked, and one | 97 // <img>,<link>,<embed>, etc. Since the requested document is blocked, and one |
98 // character string (' ') is returned instead, this tests that the renderer | 98 // character string (' ') is returned instead, this tests that the renderer |
99 // does not crash even when it receives a response body which is " ", whose | 99 // does not crash even when it receives a response body which is " ", whose |
100 // length is different from what's described in "content-length" for such | 100 // length is different from what's described in "content-length" for such |
101 // different targets. | 101 // different targets. |
102 GURL foo("http://foo.com/files/cross_site_document_request_target.html"); | 102 GURL foo("http://foo.com/files/cross_site_document_request_target.html"); |
103 NavigateToURL(shell(), foo); | 103 NavigateToURL(shell(), foo); |
104 } | 104 } |
105 | 105 |
106 } | 106 } |
OLD | NEW |