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

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

Issue 12605011: Revert 188912 "Removed static factories for data, ftp, file, and..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
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"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_ = GetContentClient()->browser(); 58 old_browser_client_ = GetContentClient()->browser();
59 GetContentClient()->set_browser_for_testing(&test_browser_client_); 59 GetContentClient()->set_browser_for_testing(&test_browser_client_);
60 60
61 // Claim to always handle chrome:// URLs because the CPSP's notion of 61 // Claim to always handle chrome:// URLs because the CPSP's notion of
62 // allowing WebUI bindings is hard-wired to this particular scheme. 62 // allowing WebUI bindings is hard-wired to this particular scheme.
63 test_browser_client_.AddScheme(chrome::kChromeUIScheme); 63 test_browser_client_.AddScheme("chrome");
64
65 // Claim to always handle file:// URLs like the browser would.
66 // net::URLRequest::IsHandledURL() no longer claims support for default
67 // protocols as this is the responsibility of the browser (which is
68 // responsible for adding the appropriate ProtocolHandler).
69 test_browser_client_.AddScheme(chrome::kFileScheme);
70 } 64 }
71 65
72 virtual void TearDown() { 66 virtual void TearDown() {
73 test_browser_client_.ClearSchemes(); 67 test_browser_client_.ClearSchemes();
74 GetContentClient()->set_browser_for_testing(old_browser_client_); 68 GetContentClient()->set_browser_for_testing(old_browser_client_);
75 } 69 }
76 70
77 protected: 71 protected:
78 void RegisterTestScheme(const std::string& scheme) { 72 void RegisterTestScheme(const std::string& scheme) {
79 test_browser_client_.AddScheme(scheme); 73 test_browser_client_.AddScheme(scheme);
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 // queried on the IO thread. The ChildProcessSecurityPolicy needs to be 544 // queried on the IO thread. The ChildProcessSecurityPolicy needs to be
551 // prepared to answer policy questions about renderers who no longer exist. 545 // prepared to answer policy questions about renderers who no longer exist.
552 546
553 // In this case, we default to secure behavior. 547 // In this case, we default to secure behavior.
554 EXPECT_FALSE(p->CanRequestURL(kRendererID, url)); 548 EXPECT_FALSE(p->CanRequestURL(kRendererID, url));
555 EXPECT_FALSE(p->CanReadFile(kRendererID, file)); 549 EXPECT_FALSE(p->CanReadFile(kRendererID, file));
556 EXPECT_FALSE(p->HasWebUIBindings(kRendererID)); 550 EXPECT_FALSE(p->HasWebUIBindings(kRendererID));
557 } 551 }
558 552
559 } // namespace content 553 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698