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

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: Fix comments for PatchSet 3 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
« no previous file with comments | « net/base/net_util.cc ('k') | net/http/http_response_info.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 GURL url;
835 bool expected_output;
836 };
837
838 const GoogleHostCase google_host_cases[] = {
839 {GURL("http://.google.com"), true},
840 {GURL("http://.youtube.com"), true},
841 {GURL("http://.gmail.com"), true},
842 {GURL("http://.doubleclick.net"), true},
843 {GURL("http://.gstatic.com"), true},
844 {GURL("http://.googlevideo.com"), true},
845 {GURL("http://.googleusercontent.com"), true},
846 {GURL("http://.googlesyndication.com"), true},
847 {GURL("http://.google-analytics.com"), true},
848 {GURL("http://.googleadservices.com"), true},
849 {GURL("http://.googleapis.com"), true},
850 {GURL("http://a.google.com"), true},
851 {GURL("http://b.youtube.com"), true},
852 {GURL("http://c.gmail.com"), true},
853 {GURL("http://google.com"), false},
854 {GURL("http://youtube.com"), false},
855 {GURL("http://gmail.com"), false},
856 {GURL("http://google.coma"), false},
857 {GURL("http://agoogle.com"), false},
858 {GURL("http://oogle.com"), false},
859 {GURL("http://google.co"), false},
860 {GURL("http://oggole.com"), false},
861 };
862
863 for (size_t i = 0; i < arraysize(google_host_cases); ++i) {
864 EXPECT_EQ(google_host_cases[i].expected_output,
865 HasGoogleHost(google_host_cases[i].url));
866 }
867 }
868
832 // Verify GetNetworkList(). 869 // Verify GetNetworkList().
833 TEST(NetUtilTest, GetNetworkList) { 870 TEST(NetUtilTest, GetNetworkList) {
834 NetworkInterfaceList list; 871 NetworkInterfaceList list;
835 ASSERT_TRUE(GetNetworkList(&list, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES)); 872 ASSERT_TRUE(GetNetworkList(&list, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES));
836 for (NetworkInterfaceList::iterator it = list.begin(); 873 for (NetworkInterfaceList::iterator it = list.begin();
837 it != list.end(); ++it) { 874 it != list.end(); ++it) {
838 // Verify that the names are not empty. 875 // Verify that the names are not empty.
839 EXPECT_FALSE(it->name.empty()); 876 EXPECT_FALSE(it->name.empty());
840 EXPECT_FALSE(it->friendly_name.empty()); 877 EXPECT_FALSE(it->friendly_name.empty());
841 878
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 TEST_P(NetUtilNonUniqueNameTest, IsHostnameNonUnique) { 1574 TEST_P(NetUtilNonUniqueNameTest, IsHostnameNonUnique) {
1538 const NonUniqueNameTestData& test_data = GetParam(); 1575 const NonUniqueNameTestData& test_data = GetParam();
1539 1576
1540 EXPECT_EQ(test_data.is_unique, IsUnique(test_data.hostname)); 1577 EXPECT_EQ(test_data.is_unique, IsUnique(test_data.hostname));
1541 } 1578 }
1542 1579
1543 INSTANTIATE_TEST_CASE_P(, NetUtilNonUniqueNameTest, 1580 INSTANTIATE_TEST_CASE_P(, NetUtilNonUniqueNameTest,
1544 testing::ValuesIn(kNonUniqueNameTestData)); 1581 testing::ValuesIn(kNonUniqueNameTestData));
1545 1582
1546 } // namespace net 1583 } // namespace net
OLDNEW
« no previous file with comments | « net/base/net_util.cc ('k') | net/http/http_response_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698