Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Side by Side Diff: content/browser/child_process_security_policy_unittest.cc

Issue 254763005: Move some content url constants to /url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and address some style nits. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "content/browser/child_process_security_policy_impl.h" 11 #include "content/browser/child_process_security_policy_impl.h"
12 #include "content/public/common/url_constants.h" 12 #include "content/public/common/url_constants.h"
13 #include "content/test/test_content_browser_client.h" 13 #include "content/test/test_content_browser_client.h"
14 #include "net/base/url_constants.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 #include "url/gurl.h" 16 #include "url/gurl.h"
16 #include "webkit/browser/fileapi/file_permission_policy.h" 17 #include "webkit/browser/fileapi/file_permission_policy.h"
17 #include "webkit/browser/fileapi/file_system_url.h" 18 #include "webkit/browser/fileapi/file_system_url.h"
18 #include "webkit/browser/fileapi/isolated_context.h" 19 #include "webkit/browser/fileapi/isolated_context.h"
19 #include "webkit/common/fileapi/file_system_types.h" 20 #include "webkit/common/fileapi/file_system_types.h"
20 21
21 namespace content { 22 namespace content {
22 namespace { 23 namespace {
23 24
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 private: 114 private:
114 ChildProcessSecurityPolicyTestBrowserClient test_browser_client_; 115 ChildProcessSecurityPolicyTestBrowserClient test_browser_client_;
115 ContentBrowserClient* old_browser_client_; 116 ContentBrowserClient* old_browser_client_;
116 }; 117 };
117 118
118 119
119 TEST_F(ChildProcessSecurityPolicyTest, IsWebSafeSchemeTest) { 120 TEST_F(ChildProcessSecurityPolicyTest, IsWebSafeSchemeTest) {
120 ChildProcessSecurityPolicyImpl* p = 121 ChildProcessSecurityPolicyImpl* p =
121 ChildProcessSecurityPolicyImpl::GetInstance(); 122 ChildProcessSecurityPolicyImpl::GetInstance();
122 123
123 EXPECT_TRUE(p->IsWebSafeScheme(kHttpScheme)); 124 EXPECT_TRUE(p->IsWebSafeScheme(net::kHttpScheme));
124 EXPECT_TRUE(p->IsWebSafeScheme(kHttpsScheme)); 125 EXPECT_TRUE(p->IsWebSafeScheme(net::kHttpsScheme));
125 EXPECT_TRUE(p->IsWebSafeScheme(kFtpScheme)); 126 EXPECT_TRUE(p->IsWebSafeScheme(kFtpScheme));
126 EXPECT_TRUE(p->IsWebSafeScheme(kDataScheme)); 127 EXPECT_TRUE(p->IsWebSafeScheme(kDataScheme));
127 EXPECT_TRUE(p->IsWebSafeScheme("feed")); 128 EXPECT_TRUE(p->IsWebSafeScheme("feed"));
128 EXPECT_TRUE(p->IsWebSafeScheme(kBlobScheme)); 129 EXPECT_TRUE(p->IsWebSafeScheme(kBlobScheme));
129 EXPECT_TRUE(p->IsWebSafeScheme(kFileSystemScheme)); 130 EXPECT_TRUE(p->IsWebSafeScheme(kFileSystemScheme));
130 131
131 EXPECT_FALSE(p->IsWebSafeScheme("registered-web-safe-scheme")); 132 EXPECT_FALSE(p->IsWebSafeScheme("registered-web-safe-scheme"));
132 p->RegisterWebSafeScheme("registered-web-safe-scheme"); 133 p->RegisterWebSafeScheme("registered-web-safe-scheme");
133 EXPECT_TRUE(p->IsWebSafeScheme("registered-web-safe-scheme")); 134 EXPECT_TRUE(p->IsWebSafeScheme("registered-web-safe-scheme"));
134 135
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 // queried on the IO thread. The ChildProcessSecurityPolicy needs to be 635 // queried on the IO thread. The ChildProcessSecurityPolicy needs to be
635 // prepared to answer policy questions about renderers who no longer exist. 636 // prepared to answer policy questions about renderers who no longer exist.
636 637
637 // In this case, we default to secure behavior. 638 // In this case, we default to secure behavior.
638 EXPECT_FALSE(p->CanRequestURL(kRendererID, url)); 639 EXPECT_FALSE(p->CanRequestURL(kRendererID, url));
639 EXPECT_FALSE(p->CanReadFile(kRendererID, file)); 640 EXPECT_FALSE(p->CanReadFile(kRendererID, file));
640 EXPECT_FALSE(p->HasWebUIBindings(kRendererID)); 641 EXPECT_FALSE(p->HasWebUIBindings(kRendererID));
641 } 642 }
642 643
643 } // namespace content 644 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698