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

Side by Side Diff: url/gurl_unittest.cc

Issue 1049533002: Add IsOriginSecure and GURL::SchemeUsesTLS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move it to content::, so we can call into net:: and blink::. 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
« url/gurl.h ('K') | « url/gurl.h ('k') | 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/macros.h" 5 #include "base/macros.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 #include "url/gurl.h" 7 #include "url/gurl.h"
8 #include "url/url_canon.h" 8 #include "url/url_canon.h"
9 #include "url/url_test_utils.h" 9 #include "url/url_test_utils.h"
10 10
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 EXPECT_TRUE(GURL("wss://bar/").SchemeIsWSOrWSS()); 635 EXPECT_TRUE(GURL("wss://bar/").SchemeIsWSOrWSS());
636 EXPECT_FALSE(GURL("http://bar/").SchemeIsWSOrWSS()); 636 EXPECT_FALSE(GURL("http://bar/").SchemeIsWSOrWSS());
637 } 637 }
638 638
639 TEST(GURLTest, SchemeIsBlob) { 639 TEST(GURLTest, SchemeIsBlob) {
640 EXPECT_TRUE(GURL("BLOB://BAR/").SchemeIsBlob()); 640 EXPECT_TRUE(GURL("BLOB://BAR/").SchemeIsBlob());
641 EXPECT_TRUE(GURL("blob://bar/").SchemeIsBlob()); 641 EXPECT_TRUE(GURL("blob://bar/").SchemeIsBlob());
642 EXPECT_FALSE(GURL("http://bar/").SchemeIsBlob()); 642 EXPECT_FALSE(GURL("http://bar/").SchemeIsBlob());
643 } 643 }
644 644
645 TEST(GURLTest, TestSecureOrigins) {
646 EXPECT_TRUE(GURL("file:///test/fun.html").OriginIsSecure());
647 EXPECT_TRUE(GURL("file:///test/").OriginIsSecure());
648
649 EXPECT_TRUE(GURL("https://example.com/fun.html").OriginIsSecure());
650 EXPECT_FALSE(GURL("http://example.com/fun.html").OriginIsSecure());
651
652 EXPECT_TRUE(GURL("wss://example.com/fun.html").OriginIsSecure());
653 EXPECT_FALSE(GURL("ws://example.com/fun.html").OriginIsSecure());
654
655 EXPECT_TRUE(GURL("http://localhost/fun.html").OriginIsSecure());
656 EXPECT_FALSE(GURL("http://localhost.com/fun.html").OriginIsSecure());
657 EXPECT_TRUE(GURL("https://localhost.com/fun.html").OriginIsSecure());
658
659 EXPECT_TRUE(GURL("http://127.0.0.1/fun.html").OriginIsSecure());
660 EXPECT_TRUE(GURL("http://127.3.0.1/fun.html").OriginIsSecure());
661 EXPECT_FALSE(GURL("http://127.example.com/fun.html").OriginIsSecure());
662 EXPECT_TRUE(GURL("https://127.example.com/fun.html").OriginIsSecure());
663
664 EXPECT_TRUE(GURL("http://[::1]/fun.html").OriginIsSecure());
665 EXPECT_FALSE(GURL("http://[::2]/fun.html").OriginIsSecure());
666 EXPECT_FALSE(GURL("http://[::1].example.com/fun.html").OriginIsSecure());
667 }
668
645 } // namespace url 669 } // namespace url
OLDNEW
« url/gurl.h ('K') | « url/gurl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698