| 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 "components/history/core/browser/url_utils.h" | 5 #include "components/history/core/browser/url_utils.h" |
| 6 | 6 |
| 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 history { | 10 namespace history { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 TEST(HistoryUrlUtilsTest, ToggleHTTPAndHTTPS) { | 120 TEST(HistoryUrlUtilsTest, ToggleHTTPAndHTTPS) { |
| 121 EXPECT_EQ(GURL("http://www.google.com/test?q#r"), | 121 EXPECT_EQ(GURL("http://www.google.com/test?q#r"), |
| 122 ToggleHTTPAndHTTPS(GURL("https://www.google.com/test?q#r"))); | 122 ToggleHTTPAndHTTPS(GURL("https://www.google.com/test?q#r"))); |
| 123 EXPECT_EQ(GURL("https://www.google.com:137/"), | 123 EXPECT_EQ(GURL("https://www.google.com:137/"), |
| 124 ToggleHTTPAndHTTPS(GURL("http://www.google.com:137/"))); | 124 ToggleHTTPAndHTTPS(GURL("http://www.google.com:137/"))); |
| 125 EXPECT_EQ(GURL::EmptyGURL(), | 125 EXPECT_EQ(GURL::EmptyGURL(), |
| 126 ToggleHTTPAndHTTPS(GURL("ftp://www.google.com/"))); | 126 ToggleHTTPAndHTTPS(GURL("ftp://www.google.com/"))); |
| 127 } | 127 } |
| 128 | 128 |
| 129 TEST(HistoryUrlUtilsTest, HostForTopHosts) { |
| 130 EXPECT_EQ("foo.com", HostForTopHosts(GURL("https://foo.com/bar"))); |
| 131 EXPECT_EQ("foo.com", HostForTopHosts(GURL("http://foo.com:999/bar"))); |
| 132 EXPECT_EQ("foo.com", HostForTopHosts(GURL("http://www.foo.com/bar"))); |
| 133 EXPECT_EQ("foo.com", HostForTopHosts(GURL("HtTP://WWw.FoO.cOM/BAR"))); |
| 134 } |
| 135 |
| 129 } // namespace | 136 } // namespace |
| 130 | 137 |
| 131 } // namespace history | 138 } // namespace history |
| OLD | NEW |