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 16 matching lines...) Expand all Loading... |
27 #define TEST_PATH(x) FILE_PATH_LITERAL("c:") FILE_PATH_LITERAL(x) | 27 #define TEST_PATH(x) FILE_PATH_LITERAL("c:") FILE_PATH_LITERAL(x) |
28 #else | 28 #else |
29 #define TEST_PATH(x) FILE_PATH_LITERAL(x) | 29 #define TEST_PATH(x) FILE_PATH_LITERAL(x) |
30 #endif | 30 #endif |
31 | 31 |
32 class ChildProcessSecurityPolicyTestBrowserClient | 32 class ChildProcessSecurityPolicyTestBrowserClient |
33 : public TestContentBrowserClient { | 33 : public TestContentBrowserClient { |
34 public: | 34 public: |
35 ChildProcessSecurityPolicyTestBrowserClient() {} | 35 ChildProcessSecurityPolicyTestBrowserClient() {} |
36 | 36 |
37 virtual bool IsHandledURL(const GURL& url) OVERRIDE { | 37 virtual bool IsHandledURL(const GURL& url) override { |
38 return schemes_.find(url.scheme()) != schemes_.end(); | 38 return schemes_.find(url.scheme()) != schemes_.end(); |
39 } | 39 } |
40 | 40 |
41 void ClearSchemes() { | 41 void ClearSchemes() { |
42 schemes_.clear(); | 42 schemes_.clear(); |
43 } | 43 } |
44 | 44 |
45 void AddScheme(const std::string& scheme) { | 45 void AddScheme(const std::string& scheme) { |
46 schemes_.insert(scheme); | 46 schemes_.insert(scheme); |
47 } | 47 } |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 // queried on the IO thread. The ChildProcessSecurityPolicy needs to be | 635 // queried on the IO thread. The ChildProcessSecurityPolicy needs to be |
636 // prepared to answer policy questions about renderers who no longer exist. | 636 // prepared to answer policy questions about renderers who no longer exist. |
637 | 637 |
638 // In this case, we default to secure behavior. | 638 // In this case, we default to secure behavior. |
639 EXPECT_FALSE(p->CanRequestURL(kRendererID, url)); | 639 EXPECT_FALSE(p->CanRequestURL(kRendererID, url)); |
640 EXPECT_FALSE(p->CanReadFile(kRendererID, file)); | 640 EXPECT_FALSE(p->CanReadFile(kRendererID, file)); |
641 EXPECT_FALSE(p->HasWebUIBindings(kRendererID)); | 641 EXPECT_FALSE(p->HasWebUIBindings(kRendererID)); |
642 } | 642 } |
643 | 643 |
644 } // namespace content | 644 } // namespace content |
OLD | NEW |