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

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

Issue 15074007: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix for windows Created 7 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 | Annotate | Revision Log
« no previous file with comments | « net/base/net_util.cc ('k') | net/net.gyp » ('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 <algorithm> 9 #include <algorithm>
10 10
(...skipping 3153 matching lines...) Expand 10 before | Expand all | Expand 10 after
3164 3164
3165 TEST(NetUtilTest, GetHostOrSpecFromURL) { 3165 TEST(NetUtilTest, GetHostOrSpecFromURL) {
3166 EXPECT_EQ("example.com", 3166 EXPECT_EQ("example.com",
3167 GetHostOrSpecFromURL(GURL("http://example.com/test"))); 3167 GetHostOrSpecFromURL(GURL("http://example.com/test")));
3168 EXPECT_EQ("example.com", 3168 EXPECT_EQ("example.com",
3169 GetHostOrSpecFromURL(GURL("http://example.com./test"))); 3169 GetHostOrSpecFromURL(GURL("http://example.com./test")));
3170 EXPECT_EQ("file:///tmp/test.html", 3170 EXPECT_EQ("file:///tmp/test.html",
3171 GetHostOrSpecFromURL(GURL("file:///tmp/test.html"))); 3171 GetHostOrSpecFromURL(GURL("file:///tmp/test.html")));
3172 } 3172 }
3173 3173
3174 TEST(NetUtilTest, GetAddressFamily) {
3175 IPAddressNumber number;
3176 EXPECT_TRUE(ParseIPLiteralToNumber("192.168.0.1", &number));
3177 EXPECT_EQ(ADDRESS_FAMILY_IPV4, GetAddressFamily(number));
3178 EXPECT_TRUE(ParseIPLiteralToNumber("1:abcd::3:4:ff", &number));
3179 EXPECT_EQ(ADDRESS_FAMILY_IPV6, GetAddressFamily(number));
3180 }
3181
3174 // Test that invalid IP literals fail to parse. 3182 // Test that invalid IP literals fail to parse.
3175 TEST(NetUtilTest, ParseIPLiteralToNumber_FailParse) { 3183 TEST(NetUtilTest, ParseIPLiteralToNumber_FailParse) {
3176 IPAddressNumber number; 3184 IPAddressNumber number;
3177 3185
3178 EXPECT_FALSE(ParseIPLiteralToNumber("bad value", &number)); 3186 EXPECT_FALSE(ParseIPLiteralToNumber("bad value", &number));
3179 EXPECT_FALSE(ParseIPLiteralToNumber("bad:value", &number)); 3187 EXPECT_FALSE(ParseIPLiteralToNumber("bad:value", &number));
3180 EXPECT_FALSE(ParseIPLiteralToNumber(std::string(), &number)); 3188 EXPECT_FALSE(ParseIPLiteralToNumber(std::string(), &number));
3181 EXPECT_FALSE(ParseIPLiteralToNumber("192.168.0.1:30", &number)); 3189 EXPECT_FALSE(ParseIPLiteralToNumber("192.168.0.1:30", &number));
3182 EXPECT_FALSE(ParseIPLiteralToNumber(" 192.168.0.1 ", &number)); 3190 EXPECT_FALSE(ParseIPLiteralToNumber(" 192.168.0.1 ", &number));
3183 EXPECT_FALSE(ParseIPLiteralToNumber("[::1]", &number)); 3191 EXPECT_FALSE(ParseIPLiteralToNumber("[::1]", &number));
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
3487 kUnsafePortableBasenames[i]))) << kUnsafePortableBasenames[i]; 3495 kUnsafePortableBasenames[i]))) << kUnsafePortableBasenames[i];
3488 if (!base::FilePath::StringType(kUnsafePortableBasenames[i]).empty()) { 3496 if (!base::FilePath::StringType(kUnsafePortableBasenames[i]).empty()) {
3489 EXPECT_FALSE(IsSafePortableRelativePath(safe_dirname.Append( 3497 EXPECT_FALSE(IsSafePortableRelativePath(safe_dirname.Append(
3490 base::FilePath(kUnsafePortableBasenames[i])))) 3498 base::FilePath(kUnsafePortableBasenames[i]))))
3491 << kUnsafePortableBasenames[i]; 3499 << kUnsafePortableBasenames[i];
3492 } 3500 }
3493 } 3501 }
3494 } 3502 }
3495 3503
3496 } // namespace net 3504 } // namespace net
OLDNEW
« no previous file with comments | « net/base/net_util.cc ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698