OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "base/basictypes.h" | |
jww
2015/04/30 18:26:42
remove?
kinuko
2015/05/01 03:10:56
Done.
| |
6 #include "base/command_line.h" | |
7 #include "chrome/common/chrome_switches.h" | |
8 #include "content/public/common/origin_util.h" | |
9 #include "testing/gtest/include/gtest/gtest.h" | |
10 #include "url/gurl.h" | |
11 | |
12 using content::IsOriginSecure; | |
13 | |
14 namespace chrome { | |
15 | |
16 TEST(SecureOriginWhiteList, UnsafetyTreatInsecureOriginAsSecure) { | |
17 EXPECT_FALSE(content::IsOriginSecure(GURL("http://example.com/fun.html"))); | |
18 EXPECT_FALSE( | |
19 content::IsOriginSecure(GURL("http://127.example.com/fun.html"))); | |
20 | |
21 // Add http://example.com and http://127.example.com to whitelist by | |
22 // command-line and see if they are now considered secure origins. | |
23 // (The command line is applied via | |
24 // ChromeContentClient::AddSecureSchemesAndOrigins) | |
25 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
26 command_line->AppendSwitchASCII( | |
27 switches::kUnsafetyTreatInsecureOriginAsSecure, | |
28 "http://example.com,http://127.example.com"); | |
29 command_line->AppendSwitch(switches::kUserDataDir); | |
30 content::ResetSecureSchemesAndOriginsForTesting(); | |
31 | |
32 EXPECT_TRUE(content::IsOriginSecure(GURL("http://example.com/fun.html"))); | |
33 EXPECT_TRUE(content::IsOriginSecure(GURL("http://127.example.com/fun.html"))); | |
jww
2015/04/30 18:26:42
Would you mind adding a few other sanity checks, s
kinuko
2015/05/01 03:10:56
Done.
| |
34 } | |
35 | |
36 } // namespace chrome | |
OLD | NEW |