OLD | NEW |
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 Loading... |
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 |
OLD | NEW |