OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "config.h" | 5 #include "config.h" |
6 #include "platform/weborigin/SchemeRegistry.h" | 6 #include "platform/weborigin/SchemeRegistry.h" |
7 | 7 |
8 #include <gtest/gtest.h> | 8 #include <gtest/gtest.h> |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy(kTestSchem
e, SchemeRegistry::PolicyAreaImage); | 43 SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy(kTestSchem
e, SchemeRegistry::PolicyAreaImage); |
44 EXPECT_FALSE(SchemeRegistry::schemeShouldBypassContentSecurityPolicy(kTestSc
heme)); | 44 EXPECT_FALSE(SchemeRegistry::schemeShouldBypassContentSecurityPolicy(kTestSc
heme)); |
45 EXPECT_FALSE(SchemeRegistry::schemeShouldBypassContentSecurityPolicy(kTestSc
hemeUppercase)); | 45 EXPECT_FALSE(SchemeRegistry::schemeShouldBypassContentSecurityPolicy(kTestSc
hemeUppercase)); |
46 EXPECT_TRUE(SchemeRegistry::schemeShouldBypassContentSecurityPolicy(kTestSch
eme, SchemeRegistry::PolicyAreaImage)); | 46 EXPECT_TRUE(SchemeRegistry::schemeShouldBypassContentSecurityPolicy(kTestSch
eme, SchemeRegistry::PolicyAreaImage)); |
47 EXPECT_TRUE(SchemeRegistry::schemeShouldBypassContentSecurityPolicy(kTestSch
emeUppercase, SchemeRegistry::PolicyAreaImage)); | 47 EXPECT_TRUE(SchemeRegistry::schemeShouldBypassContentSecurityPolicy(kTestSch
emeUppercase, SchemeRegistry::PolicyAreaImage)); |
48 EXPECT_FALSE(SchemeRegistry::schemeShouldBypassContentSecurityPolicy(kTestSc
heme, SchemeRegistry::PolicyAreaStyle)); | 48 EXPECT_FALSE(SchemeRegistry::schemeShouldBypassContentSecurityPolicy(kTestSc
heme, SchemeRegistry::PolicyAreaStyle)); |
49 EXPECT_FALSE(SchemeRegistry::schemeShouldBypassContentSecurityPolicy(kTestSc
hemeUppercase, SchemeRegistry::PolicyAreaStyle)); | 49 EXPECT_FALSE(SchemeRegistry::schemeShouldBypassContentSecurityPolicy(kTestSc
hemeUppercase, SchemeRegistry::PolicyAreaStyle)); |
50 EXPECT_FALSE(SchemeRegistry::schemeShouldBypassContentSecurityPolicy(kTestSc
heme2, SchemeRegistry::PolicyAreaImage)); | 50 EXPECT_FALSE(SchemeRegistry::schemeShouldBypassContentSecurityPolicy(kTestSc
heme2, SchemeRegistry::PolicyAreaImage)); |
51 } | 51 } |
52 | 52 |
| 53 TEST_F(SchemeRegistryTest, BypassSecureContextCheck) |
| 54 { |
| 55 const char* scheme1 = "http"; |
| 56 const char* scheme2 = "https"; |
| 57 const char* scheme3 = "random-scheme"; |
| 58 const char* scheme4 = "RANDOM-SCHEME"; |
| 59 |
| 60 EXPECT_FALSE(SchemeRegistry::schemeShouldBypassSecureContextCheck(scheme1)); |
| 61 EXPECT_FALSE(SchemeRegistry::schemeShouldBypassSecureContextCheck(scheme2)); |
| 62 EXPECT_FALSE(SchemeRegistry::schemeShouldBypassSecureContextCheck(scheme3)); |
| 63 EXPECT_FALSE(SchemeRegistry::schemeShouldBypassSecureContextCheck(scheme4)); |
| 64 |
| 65 SchemeRegistry::registerURLSchemeBypassingSecureContextCheck("random-scheme"
); |
| 66 |
| 67 EXPECT_FALSE(SchemeRegistry::schemeShouldBypassSecureContextCheck(scheme1)); |
| 68 EXPECT_FALSE(SchemeRegistry::schemeShouldBypassSecureContextCheck(scheme2)); |
| 69 EXPECT_TRUE(SchemeRegistry::schemeShouldBypassSecureContextCheck(scheme3)); |
| 70 EXPECT_TRUE(SchemeRegistry::schemeShouldBypassSecureContextCheck(scheme4)); |
| 71 } |
| 72 |
53 } // namespace | 73 } // namespace |
54 } // namespace blink | 74 } // namespace blink |
OLD | NEW |