| 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 "content/browser/child_process_security_policy_impl.h" | 10 #include "content/browser/child_process_security_policy_impl.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 p->RegisterWebSafeScheme("registered-web-safe-scheme"); | 131 p->RegisterWebSafeScheme("registered-web-safe-scheme"); |
| 132 EXPECT_TRUE(p->IsWebSafeScheme("registered-web-safe-scheme")); | 132 EXPECT_TRUE(p->IsWebSafeScheme("registered-web-safe-scheme")); |
| 133 | 133 |
| 134 EXPECT_FALSE(p->IsWebSafeScheme(kChromeUIScheme)); | 134 EXPECT_FALSE(p->IsWebSafeScheme(kChromeUIScheme)); |
| 135 } | 135 } |
| 136 | 136 |
| 137 TEST_F(ChildProcessSecurityPolicyTest, IsPseudoSchemeTest) { | 137 TEST_F(ChildProcessSecurityPolicyTest, IsPseudoSchemeTest) { |
| 138 ChildProcessSecurityPolicyImpl* p = | 138 ChildProcessSecurityPolicyImpl* p = |
| 139 ChildProcessSecurityPolicyImpl::GetInstance(); | 139 ChildProcessSecurityPolicyImpl::GetInstance(); |
| 140 | 140 |
| 141 EXPECT_TRUE(p->IsPseudoScheme(kAboutScheme)); | 141 EXPECT_TRUE(p->IsPseudoScheme(url::kAboutScheme)); |
| 142 EXPECT_TRUE(p->IsPseudoScheme(url::kJavaScriptScheme)); | 142 EXPECT_TRUE(p->IsPseudoScheme(url::kJavaScriptScheme)); |
| 143 EXPECT_TRUE(p->IsPseudoScheme(kViewSourceScheme)); | 143 EXPECT_TRUE(p->IsPseudoScheme(kViewSourceScheme)); |
| 144 | 144 |
| 145 EXPECT_FALSE(p->IsPseudoScheme("registered-pseudo-scheme")); | 145 EXPECT_FALSE(p->IsPseudoScheme("registered-pseudo-scheme")); |
| 146 p->RegisterPseudoScheme("registered-pseudo-scheme"); | 146 p->RegisterPseudoScheme("registered-pseudo-scheme"); |
| 147 EXPECT_TRUE(p->IsPseudoScheme("registered-pseudo-scheme")); | 147 EXPECT_TRUE(p->IsPseudoScheme("registered-pseudo-scheme")); |
| 148 | 148 |
| 149 EXPECT_FALSE(p->IsPseudoScheme(kChromeUIScheme)); | 149 EXPECT_FALSE(p->IsPseudoScheme(kChromeUIScheme)); |
| 150 } | 150 } |
| 151 | 151 |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 // queried on the IO thread. The ChildProcessSecurityPolicy needs to be | 633 // queried on the IO thread. The ChildProcessSecurityPolicy needs to be |
| 634 // prepared to answer policy questions about renderers who no longer exist. | 634 // prepared to answer policy questions about renderers who no longer exist. |
| 635 | 635 |
| 636 // In this case, we default to secure behavior. | 636 // In this case, we default to secure behavior. |
| 637 EXPECT_FALSE(p->CanRequestURL(kRendererID, url)); | 637 EXPECT_FALSE(p->CanRequestURL(kRendererID, url)); |
| 638 EXPECT_FALSE(p->CanReadFile(kRendererID, file)); | 638 EXPECT_FALSE(p->CanReadFile(kRendererID, file)); |
| 639 EXPECT_FALSE(p->HasWebUIBindings(kRendererID)); | 639 EXPECT_FALSE(p->HasWebUIBindings(kRendererID)); |
| 640 } | 640 } |
| 641 | 641 |
| 642 } // namespace content | 642 } // namespace content |
| OLD | NEW |