| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 | 638 |
| 639 GURL url_2("filesystem:http://www.iamnotgoogle.com/foo/"); | 639 GURL url_2("filesystem:http://www.iamnotgoogle.com/foo/"); |
| 640 EXPECT_FALSE(url_2.DomainIs("google.com")); | 640 EXPECT_FALSE(url_2.DomainIs("google.com")); |
| 641 } | 641 } |
| 642 | 642 |
| 643 // Newlines should be stripped from inputs. | 643 // Newlines should be stripped from inputs. |
| 644 TEST(GURLTest, Newlines) { | 644 TEST(GURLTest, Newlines) { |
| 645 // Constructor. | 645 // Constructor. |
| 646 GURL url_1(" \t ht\ntp://\twww.goo\rgle.com/as\ndf \n "); | 646 GURL url_1(" \t ht\ntp://\twww.goo\rgle.com/as\ndf \n "); |
| 647 EXPECT_EQ("http://www.google.com/asdf", url_1.spec()); | 647 EXPECT_EQ("http://www.google.com/asdf", url_1.spec()); |
| 648 EXPECT_TRUE(url_1.parsed_for_possibly_invalid_spec().whitespace_removed); |
| 648 | 649 |
| 649 // Relative path resolver. | 650 // Relative path resolver. |
| 650 GURL url_2 = url_1.Resolve(" \n /fo\to\r "); | 651 GURL url_2 = url_1.Resolve(" \n /fo\to\r "); |
| 651 EXPECT_EQ("http://www.google.com/foo", url_2.spec()); | 652 EXPECT_EQ("http://www.google.com/foo", url_2.spec()); |
| 653 EXPECT_TRUE(url_2.parsed_for_possibly_invalid_spec().whitespace_removed); |
| 652 | 654 |
| 653 // Note that newlines are NOT stripped from ReplaceComponents. | 655 // Note that newlines are NOT stripped from ReplaceComponents. |
| 654 } | 656 } |
| 655 | 657 |
| 656 TEST(GURLTest, IsStandard) { | 658 TEST(GURLTest, IsStandard) { |
| 657 GURL a("http:foo/bar"); | 659 GURL a("http:foo/bar"); |
| 658 EXPECT_TRUE(a.IsStandard()); | 660 EXPECT_TRUE(a.IsStandard()); |
| 659 | 661 |
| 660 GURL b("foo:bar/baz"); | 662 GURL b("foo:bar/baz"); |
| 661 EXPECT_FALSE(b.IsStandard()); | 663 EXPECT_FALSE(b.IsStandard()); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 // A versus B. | 809 // A versus B. |
| 808 EXPECT_EQ(test_case.are_equals, | 810 EXPECT_EQ(test_case.are_equals, |
| 809 GURL(test_case.url_a).EqualsIgnoringRef(GURL(test_case.url_b))); | 811 GURL(test_case.url_a).EqualsIgnoringRef(GURL(test_case.url_b))); |
| 810 // B versus A. | 812 // B versus A. |
| 811 EXPECT_EQ(test_case.are_equals, | 813 EXPECT_EQ(test_case.are_equals, |
| 812 GURL(test_case.url_b).EqualsIgnoringRef(GURL(test_case.url_a))); | 814 GURL(test_case.url_b).EqualsIgnoringRef(GURL(test_case.url_a))); |
| 813 } | 815 } |
| 814 } | 816 } |
| 815 | 817 |
| 816 } // namespace url | 818 } // namespace url |
| OLD | NEW |