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

Side by Side Diff: net/base/net_util_unittest.cc

Issue 1096783005: QUIC - Collect performance stats for QUIC vs non-QUIC when google (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor comment fix Created 5 years, 7 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
OLDNEW
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/net_util.h" 5 #include "net/base/net_util.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <ostream> 9 #include <ostream>
10 10
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 } 822 }
823 823
824 TEST(NetUtilTest, IsLocalhostTLD) { 824 TEST(NetUtilTest, IsLocalhostTLD) {
825 EXPECT_TRUE(IsLocalhostTLD("foo.localhost")); 825 EXPECT_TRUE(IsLocalhostTLD("foo.localhost"));
826 EXPECT_TRUE(IsLocalhostTLD("foo.localhost.")); 826 EXPECT_TRUE(IsLocalhostTLD("foo.localhost."));
827 EXPECT_FALSE(IsLocalhostTLD("foo.localhos")); 827 EXPECT_FALSE(IsLocalhostTLD("foo.localhos"));
828 EXPECT_FALSE(IsLocalhostTLD("foo.localhost.com")); 828 EXPECT_FALSE(IsLocalhostTLD("foo.localhost.com"));
829 EXPECT_FALSE(IsLocalhost("foo.localhoste")); 829 EXPECT_FALSE(IsLocalhost("foo.localhoste"));
830 } 830 }
831 831
832 TEST(NetUtilTest, GoogleHost) {
833 struct GoogleHostCase {
834 const char* const host;
835 bool expected_output;
836 };
837
838 const GoogleHostCase google_host_cases[] = {
839 {"", false},
840 {"google.com", true},
841 {"youtube.com", true},
842 {"gmail.com", true},
843 {"doubleclick.net", true},
844 {"gstatic.com", true},
845 {"googlevideo.com", true},
846 {"googleusercontent.com", true},
847 {"googlesyndication.com", true},
848 {"google-analytics.com", true},
849 {"googleadservices.com", true},
850 {"googleapis.com", true},
851 {".google.com", true},
852 {".youtube.com", true},
853 {".gmail.com", true},
854 {"a.google.com", true},
855 {"b.youtube.com", true},
856 {"c.gmail.com", true},
857 {"google.coma", false},
858 {"agoogle.com", false},
859 {"oogle.com", false},
860 {"google.co", false},
861 {"oggole.com", false},
862 };
863
864 for (size_t i = 0; i < arraysize(google_host_cases); ++i) {
865 EXPECT_EQ(google_host_cases[i].expected_output,
866 IsGoogleHost(google_host_cases[i].host));
867 }
868 }
869
832 // Verify GetNetworkList(). 870 // Verify GetNetworkList().
833 TEST(NetUtilTest, GetNetworkList) { 871 TEST(NetUtilTest, GetNetworkList) {
834 NetworkInterfaceList list; 872 NetworkInterfaceList list;
835 ASSERT_TRUE(GetNetworkList(&list, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES)); 873 ASSERT_TRUE(GetNetworkList(&list, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES));
836 for (NetworkInterfaceList::iterator it = list.begin(); 874 for (NetworkInterfaceList::iterator it = list.begin();
837 it != list.end(); ++it) { 875 it != list.end(); ++it) {
838 // Verify that the names are not empty. 876 // Verify that the names are not empty.
839 EXPECT_FALSE(it->name.empty()); 877 EXPECT_FALSE(it->name.empty());
840 EXPECT_FALSE(it->friendly_name.empty()); 878 EXPECT_FALSE(it->friendly_name.empty());
841 879
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 TEST_P(NetUtilNonUniqueNameTest, IsHostnameNonUnique) { 1575 TEST_P(NetUtilNonUniqueNameTest, IsHostnameNonUnique) {
1538 const NonUniqueNameTestData& test_data = GetParam(); 1576 const NonUniqueNameTestData& test_data = GetParam();
1539 1577
1540 EXPECT_EQ(test_data.is_unique, IsUnique(test_data.hostname)); 1578 EXPECT_EQ(test_data.is_unique, IsUnique(test_data.hostname));
1541 } 1579 }
1542 1580
1543 INSTANTIATE_TEST_CASE_P(, NetUtilNonUniqueNameTest, 1581 INSTANTIATE_TEST_CASE_P(, NetUtilNonUniqueNameTest,
1544 testing::ValuesIn(kNonUniqueNameTestData)); 1582 testing::ValuesIn(kNonUniqueNameTestData));
1545 1583
1546 } // namespace net 1584 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698