| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/base/registry_controlled_domains/registry_controlled_domain.h" | 5 #include "net/base/registry_controlled_domains/registry_controlled_domain.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 | 8 |
| 9 namespace { | 9 namespace { |
| 10 namespace test1 { | 10 namespace test1 { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 } // namespace | 76 } // namespace |
| 77 | 77 |
| 78 class RegistryControlledDomainTest : public testing::Test { | 78 class RegistryControlledDomainTest : public testing::Test { |
| 79 protected: | 79 protected: |
| 80 template <typename Graph> | 80 template <typename Graph> |
| 81 void UseDomainData(const Graph& graph) { | 81 void UseDomainData(const Graph& graph) { |
| 82 SetFindDomainGraph(graph, sizeof(Graph)); | 82 SetFindDomainGraph(graph, sizeof(Graph)); |
| 83 } | 83 } |
| 84 | 84 |
| 85 virtual void TearDown() { SetFindDomainGraph(); } | 85 void TearDown() override { SetFindDomainGraph(); } |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 TEST_F(RegistryControlledDomainTest, TestGetDomainAndRegistry) { | 88 TEST_F(RegistryControlledDomainTest, TestGetDomainAndRegistry) { |
| 89 UseDomainData(test1::kDafsa); | 89 UseDomainData(test1::kDafsa); |
| 90 | 90 |
| 91 // Test GURL version of GetDomainAndRegistry(). | 91 // Test GURL version of GetDomainAndRegistry(). |
| 92 EXPECT_EQ("baz.jp", GetDomainFromURL("http://a.baz.jp/file.html")); // 1 | 92 EXPECT_EQ("baz.jp", GetDomainFromURL("http://a.baz.jp/file.html")); // 1 |
| 93 EXPECT_EQ("baz.jp.", GetDomainFromURL("http://a.baz.jp./file.html")); // 1 | 93 EXPECT_EQ("baz.jp.", GetDomainFromURL("http://a.baz.jp./file.html")); // 1 |
| 94 EXPECT_EQ("", GetDomainFromURL("http://ac.jp")); // 2 | 94 EXPECT_EQ("", GetDomainFromURL("http://ac.jp")); // 2 |
| 95 EXPECT_EQ("", GetDomainFromURL("http://a.bar.jp")); // 3 | 95 EXPECT_EQ("", GetDomainFromURL("http://a.bar.jp")); // 3 |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 GetRegistryLengthFromHostIncludingPrivate( | 491 GetRegistryLengthFromHostIncludingPrivate( |
| 492 key4, EXCLUDE_UNKNOWN_REGISTRIES)); | 492 key4, EXCLUDE_UNKNOWN_REGISTRIES)); |
| 493 EXPECT_EQ(0U, | 493 EXPECT_EQ(0U, |
| 494 GetRegistryLengthFromHostIncludingPrivate( | 494 GetRegistryLengthFromHostIncludingPrivate( |
| 495 key5, EXCLUDE_UNKNOWN_REGISTRIES)); | 495 key5, EXCLUDE_UNKNOWN_REGISTRIES)); |
| 496 EXPECT_EQ(5U, GetRegistryLengthFromHost(key6, EXCLUDE_UNKNOWN_REGISTRIES)); | 496 EXPECT_EQ(5U, GetRegistryLengthFromHost(key6, EXCLUDE_UNKNOWN_REGISTRIES)); |
| 497 EXPECT_EQ(5U, GetRegistryLengthFromHost(key7, EXCLUDE_UNKNOWN_REGISTRIES)); | 497 EXPECT_EQ(5U, GetRegistryLengthFromHost(key7, EXCLUDE_UNKNOWN_REGISTRIES)); |
| 498 } | 498 } |
| 499 } // namespace registry_controlled_domains | 499 } // namespace registry_controlled_domains |
| 500 } // namespace net | 500 } // namespace net |
| OLD | NEW |