OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <set> | 5 #include <set> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 class ChildProcessSecurityPolicyTest : public testing::Test { | 52 class ChildProcessSecurityPolicyTest : public testing::Test { |
53 public: | 53 public: |
54 ChildProcessSecurityPolicyTest() : old_browser_client_(NULL) { | 54 ChildProcessSecurityPolicyTest() : old_browser_client_(NULL) { |
55 } | 55 } |
56 | 56 |
57 virtual void SetUp() { | 57 virtual void SetUp() { |
58 old_browser_client_ = SetBrowserClientForTesting(&test_browser_client_); | 58 old_browser_client_ = SetBrowserClientForTesting(&test_browser_client_); |
59 | 59 |
60 // Claim to always handle chrome:// URLs because the CPSP's notion of | 60 // Claim to always handle chrome:// URLs because the CPSP's notion of |
61 // allowing WebUI bindings is hard-wired to this particular scheme. | 61 // allowing WebUI bindings is hard-wired to this particular scheme. |
62 test_browser_client_.AddScheme("chrome"); | 62 test_browser_client_.AddScheme(chrome::kChromeUIScheme); |
| 63 |
| 64 // Claim to always handle file:// URLs like the browser would. |
| 65 // net::URLRequest::IsHandledURL() no longer claims support for default |
| 66 // protocols as this is the responsibility of the browser (which is |
| 67 // responsible for adding the appropriate ProtocolHandler). |
| 68 test_browser_client_.AddScheme(chrome::kFileScheme); |
63 } | 69 } |
64 | 70 |
65 virtual void TearDown() { | 71 virtual void TearDown() { |
66 test_browser_client_.ClearSchemes(); | 72 test_browser_client_.ClearSchemes(); |
67 SetBrowserClientForTesting(old_browser_client_); | 73 SetBrowserClientForTesting(old_browser_client_); |
68 } | 74 } |
69 | 75 |
70 protected: | 76 protected: |
71 void RegisterTestScheme(const std::string& scheme) { | 77 void RegisterTestScheme(const std::string& scheme) { |
72 test_browser_client_.AddScheme(scheme); | 78 test_browser_client_.AddScheme(scheme); |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 // queried on the IO thread. The ChildProcessSecurityPolicy needs to be | 549 // queried on the IO thread. The ChildProcessSecurityPolicy needs to be |
544 // prepared to answer policy questions about renderers who no longer exist. | 550 // prepared to answer policy questions about renderers who no longer exist. |
545 | 551 |
546 // In this case, we default to secure behavior. | 552 // In this case, we default to secure behavior. |
547 EXPECT_FALSE(p->CanRequestURL(kRendererID, url)); | 553 EXPECT_FALSE(p->CanRequestURL(kRendererID, url)); |
548 EXPECT_FALSE(p->CanReadFile(kRendererID, file)); | 554 EXPECT_FALSE(p->CanReadFile(kRendererID, file)); |
549 EXPECT_FALSE(p->HasWebUIBindings(kRendererID)); | 555 EXPECT_FALSE(p->HasWebUIBindings(kRendererID)); |
550 } | 556 } |
551 | 557 |
552 } // namespace content | 558 } // namespace content |
OLD | NEW |