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

Side by Side Diff: content/common/origin_util_unittest.cc

Issue 1143633003: Add more test cases for IsOriginSecure. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Try different ports, too. Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "content/public/common/origin_util.h" 6 #include "content/public/common/origin_util.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "url/gurl.h" 8 #include "url/gurl.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 TEST(URLSchemesTest, IsOriginSecure) { 12 TEST(URLSchemesTest, IsOriginSecure) {
13 EXPECT_TRUE(IsOriginSecure(GURL("file:///test/fun.html"))); 13 EXPECT_TRUE(IsOriginSecure(GURL("file:///test/fun.html")));
14 EXPECT_TRUE(IsOriginSecure(GURL("file:///test/"))); 14 EXPECT_TRUE(IsOriginSecure(GURL("file:///test/")));
15 15
16 EXPECT_TRUE(IsOriginSecure(GURL("https://example.com/fun.html"))); 16 EXPECT_TRUE(IsOriginSecure(GURL("https://example.com/fun.html")));
17 EXPECT_FALSE(IsOriginSecure(GURL("http://example.com/fun.html"))); 17 EXPECT_FALSE(IsOriginSecure(GURL("http://example.com/fun.html")));
18 18
19 EXPECT_TRUE(IsOriginSecure(GURL("wss://example.com/fun.html"))); 19 EXPECT_TRUE(IsOriginSecure(GURL("wss://example.com/fun.html")));
20 EXPECT_FALSE(IsOriginSecure(GURL("ws://example.com/fun.html"))); 20 EXPECT_FALSE(IsOriginSecure(GURL("ws://example.com/fun.html")));
21 21
22 EXPECT_TRUE(IsOriginSecure(GURL("http://localhost/fun.html"))); 22 EXPECT_TRUE(IsOriginSecure(GURL("http://localhost/fun.html")));
23 EXPECT_TRUE(IsOriginSecure(GURL("http://pumpkin.localhost/fun.html")));
24 EXPECT_TRUE(
25 IsOriginSecure(GURL("http://crumpet.pumpkin.localhost/fun.html")));
26 EXPECT_TRUE(IsOriginSecure(GURL("http://pumpkin.localhost:8080/fun.html")));
27 EXPECT_TRUE(
28 IsOriginSecure(GURL("http://crumpet.pumpkin.localhost:3000/fun.html")));
23 EXPECT_FALSE(IsOriginSecure(GURL("http://localhost.com/fun.html"))); 29 EXPECT_FALSE(IsOriginSecure(GURL("http://localhost.com/fun.html")));
24 EXPECT_TRUE(IsOriginSecure(GURL("https://localhost.com/fun.html"))); 30 EXPECT_TRUE(IsOriginSecure(GURL("https://localhost.com/fun.html")));
25 31
26 EXPECT_TRUE(IsOriginSecure(GURL("http://127.0.0.1/fun.html"))); 32 EXPECT_TRUE(IsOriginSecure(GURL("http://127.0.0.1/fun.html")));
27 EXPECT_TRUE(IsOriginSecure(GURL("ftp://127.0.0.1/fun.html"))); 33 EXPECT_TRUE(IsOriginSecure(GURL("ftp://127.0.0.1/fun.html")));
28 EXPECT_TRUE(IsOriginSecure(GURL("http://127.3.0.1/fun.html"))); 34 EXPECT_TRUE(IsOriginSecure(GURL("http://127.3.0.1/fun.html")));
29 EXPECT_FALSE(IsOriginSecure(GURL("http://127.example.com/fun.html"))); 35 EXPECT_FALSE(IsOriginSecure(GURL("http://127.example.com/fun.html")));
30 EXPECT_TRUE(IsOriginSecure(GURL("https://127.example.com/fun.html"))); 36 EXPECT_TRUE(IsOriginSecure(GURL("https://127.example.com/fun.html")));
31 37
32 EXPECT_TRUE(IsOriginSecure(GURL("http://[::1]/fun.html"))); 38 EXPECT_TRUE(IsOriginSecure(GURL("http://[::1]/fun.html")));
33 EXPECT_FALSE(IsOriginSecure(GURL("http://[::2]/fun.html"))); 39 EXPECT_FALSE(IsOriginSecure(GURL("http://[::2]/fun.html")));
34 EXPECT_FALSE(IsOriginSecure(GURL("http://[::1].example.com/fun.html"))); 40 EXPECT_FALSE(IsOriginSecure(GURL("http://[::1].example.com/fun.html")));
35 41
36 EXPECT_FALSE( 42 EXPECT_FALSE(
37 IsOriginSecure(GURL("filesystem:http://www.example.com/temporary/"))); 43 IsOriginSecure(GURL("filesystem:http://www.example.com/temporary/")));
38 EXPECT_FALSE( 44 EXPECT_FALSE(
39 IsOriginSecure(GURL("filesystem:ftp://www.example.com/temporary/"))); 45 IsOriginSecure(GURL("filesystem:ftp://www.example.com/temporary/")));
40 EXPECT_TRUE(IsOriginSecure(GURL("filesystem:ftp://127.0.0.1/temporary/"))); 46 EXPECT_TRUE(IsOriginSecure(GURL("filesystem:ftp://127.0.0.1/temporary/")));
41 EXPECT_TRUE( 47 EXPECT_TRUE(
42 IsOriginSecure(GURL("filesystem:https://www.example.com/temporary/"))); 48 IsOriginSecure(GURL("filesystem:https://www.example.com/temporary/")));
43 } 49 }
44 50
45 } // namespace content 51 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698