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

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

Issue 1049533002: Add IsOriginSecure and GURL::SchemeUsesTLS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: One does not simply check schemes and hosts for membership in tiny sets... Created 5 years, 8 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
OLDNEW
(Empty)
1 // Copyright (c) 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 "content/public/common/origin_util.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "url/gurl.h"
9
10 TEST(URLSchemesTest, IsOriginSecure) {
11 EXPECT_TRUE(content::IsOriginSecure(GURL("file:///test/fun.html")));
12 EXPECT_TRUE(content::IsOriginSecure(GURL("file:///test/")));
13
14 EXPECT_TRUE(content::IsOriginSecure(GURL("https://example.com/fun.html")));
15 EXPECT_FALSE(content::IsOriginSecure(GURL("http://example.com/fun.html")));
16
17 EXPECT_TRUE(content::IsOriginSecure(GURL("wss://example.com/fun.html")));
18 EXPECT_FALSE(content::IsOriginSecure(GURL("ws://example.com/fun.html")));
19
20 EXPECT_TRUE(content::IsOriginSecure(GURL("http://localhost/fun.html")));
21 EXPECT_FALSE(content::IsOriginSecure(GURL("http://localhost.com/fun.html")));
22 EXPECT_TRUE(content::IsOriginSecure(GURL("https://localhost.com/fun.html")));
23
24 EXPECT_TRUE(content::IsOriginSecure(GURL("http://127.0.0.1/fun.html")));
25 EXPECT_TRUE(content::IsOriginSecure(GURL("http://127.3.0.1/fun.html")));
26 EXPECT_FALSE(
27 content::IsOriginSecure(GURL("http://127.example.com/fun.html")));
28 EXPECT_TRUE(
29 content::IsOriginSecure(GURL("https://127.example.com/fun.html")));
30
31 EXPECT_TRUE(content::IsOriginSecure(GURL("http://[::1]/fun.html")));
32 EXPECT_FALSE(content::IsOriginSecure(GURL("http://[::2]/fun.html")));
33 EXPECT_FALSE(
34 content::IsOriginSecure(GURL("http://[::1].example.com/fun.html")));
35 }
OLDNEW
« no previous file with comments | « chrome/common/origin_util.cc ('k') | content/content_common.gypi » ('j') | url/gurl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698