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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 private: | 92 private: |
93 ChildProcessSecurityPolicyTestBrowserClient test_browser_client_; | 93 ChildProcessSecurityPolicyTestBrowserClient test_browser_client_; |
94 ContentBrowserClient* old_browser_client_; | 94 ContentBrowserClient* old_browser_client_; |
95 }; | 95 }; |
96 | 96 |
97 | 97 |
98 TEST_F(ChildProcessSecurityPolicyTest, IsWebSafeSchemeTest) { | 98 TEST_F(ChildProcessSecurityPolicyTest, IsWebSafeSchemeTest) { |
99 ChildProcessSecurityPolicyImpl* p = | 99 ChildProcessSecurityPolicyImpl* p = |
100 ChildProcessSecurityPolicyImpl::GetInstance(); | 100 ChildProcessSecurityPolicyImpl::GetInstance(); |
101 | 101 |
102 EXPECT_TRUE(p->IsWebSafeScheme(chrome::kHttpScheme)); | 102 EXPECT_TRUE(p->IsWebSafeScheme(kHttpScheme)); |
103 EXPECT_TRUE(p->IsWebSafeScheme(kHttpsScheme)); | 103 EXPECT_TRUE(p->IsWebSafeScheme(kHttpsScheme)); |
104 EXPECT_TRUE(p->IsWebSafeScheme(chrome::kFtpScheme)); | 104 EXPECT_TRUE(p->IsWebSafeScheme(chrome::kFtpScheme)); |
105 EXPECT_TRUE(p->IsWebSafeScheme(chrome::kDataScheme)); | 105 EXPECT_TRUE(p->IsWebSafeScheme(chrome::kDataScheme)); |
106 EXPECT_TRUE(p->IsWebSafeScheme("feed")); | 106 EXPECT_TRUE(p->IsWebSafeScheme("feed")); |
107 EXPECT_TRUE(p->IsWebSafeScheme(chrome::kBlobScheme)); | 107 EXPECT_TRUE(p->IsWebSafeScheme(chrome::kBlobScheme)); |
108 EXPECT_TRUE(p->IsWebSafeScheme(chrome::kFileSystemScheme)); | 108 EXPECT_TRUE(p->IsWebSafeScheme(chrome::kFileSystemScheme)); |
109 | 109 |
110 EXPECT_FALSE(p->IsWebSafeScheme("registered-web-safe-scheme")); | 110 EXPECT_FALSE(p->IsWebSafeScheme("registered-web-safe-scheme")); |
111 p->RegisterWebSafeScheme("registered-web-safe-scheme"); | 111 p->RegisterWebSafeScheme("registered-web-safe-scheme"); |
112 EXPECT_TRUE(p->IsWebSafeScheme("registered-web-safe-scheme")); | 112 EXPECT_TRUE(p->IsWebSafeScheme("registered-web-safe-scheme")); |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 // queried on the IO thread. The ChildProcessSecurityPolicy needs to be | 708 // queried on the IO thread. The ChildProcessSecurityPolicy needs to be |
709 // prepared to answer policy questions about renderers who no longer exist. | 709 // prepared to answer policy questions about renderers who no longer exist. |
710 | 710 |
711 // In this case, we default to secure behavior. | 711 // In this case, we default to secure behavior. |
712 EXPECT_FALSE(p->CanRequestURL(kRendererID, url)); | 712 EXPECT_FALSE(p->CanRequestURL(kRendererID, url)); |
713 EXPECT_FALSE(p->CanReadFile(kRendererID, file)); | 713 EXPECT_FALSE(p->CanReadFile(kRendererID, file)); |
714 EXPECT_FALSE(p->HasWebUIBindings(kRendererID)); | 714 EXPECT_FALSE(p->HasWebUIBindings(kRendererID)); |
715 } | 715 } |
716 | 716 |
717 } // namespace content | 717 } // namespace content |
OLD | NEW |