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

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

Issue 1696013: Makes FormatURL not strip http for view-source urls. (Closed)
Patch Set: Incorporated review feedback Created 10 years, 8 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') | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 {"view-source", 1368 {"view-source",
1369 "view-source:http://xn--qcka1pmc.jp/", L"ja", default_format_type, 1369 "view-source:http://xn--qcka1pmc.jp/", L"ja", default_format_type,
1370 UnescapeRule::NORMAL, L"view-source:http://\x30B0\x30FC\x30B0\x30EB.jp/", 1370 UnescapeRule::NORMAL, L"view-source:http://\x30B0\x30FC\x30B0\x30EB.jp/",
1371 12 + 7}, 1371 12 + 7},
1372 1372
1373 {"view-source of view-source", 1373 {"view-source of view-source",
1374 "view-source:view-source:http://xn--qcka1pmc.jp/", L"ja", 1374 "view-source:view-source:http://xn--qcka1pmc.jp/", L"ja",
1375 default_format_type, UnescapeRule::NORMAL, 1375 default_format_type, UnescapeRule::NORMAL,
1376 L"view-source:view-source:http://xn--qcka1pmc.jp/", 12}, 1376 L"view-source:view-source:http://xn--qcka1pmc.jp/", 12},
1377 1377
1378 // view-source should not omit http.
1379 {"view-source omit http",
1380 "view-source:http://a.b/c", L"en", net::kFormatUrlOmitAll,
1381 UnescapeRule::NORMAL, L"view-source:http://a.b/c",
1382 19},
1383
1378 // -------- omit http: -------- 1384 // -------- omit http: --------
1379 {"omit http with user name", 1385 {"omit http with user name",
1380 "http://user@example.com/foo", L"", net::kFormatUrlOmitAll, 1386 "http://user@example.com/foo", L"", net::kFormatUrlOmitAll,
1381 UnescapeRule::NORMAL, L"example.com/foo", 0}, 1387 UnescapeRule::NORMAL, L"example.com/foo", 0},
1382 1388
1383 {"omit http", 1389 {"omit http",
1384 "http://www.google.com/", L"en", net::kFormatUrlOmitHTTP, 1390 "http://www.google.com/", L"en", net::kFormatUrlOmitHTTP,
1385 UnescapeRule::NORMAL, L"www.google.com/", 1391 UnescapeRule::NORMAL, L"www.google.com/",
1386 0}, 1392 0},
1387 1393
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
1750 } 1756 }
1751 1757
1752 TEST(NetUtilTest, GetHostOrSpecFromURL) { 1758 TEST(NetUtilTest, GetHostOrSpecFromURL) {
1753 EXPECT_EQ("example.com", 1759 EXPECT_EQ("example.com",
1754 net::GetHostOrSpecFromURL(GURL("http://example.com/test"))); 1760 net::GetHostOrSpecFromURL(GURL("http://example.com/test")));
1755 EXPECT_EQ("example.com", 1761 EXPECT_EQ("example.com",
1756 net::GetHostOrSpecFromURL(GURL("http://example.com./test"))); 1762 net::GetHostOrSpecFromURL(GURL("http://example.com./test")));
1757 EXPECT_EQ("file:///tmp/test.html", 1763 EXPECT_EQ("file:///tmp/test.html",
1758 net::GetHostOrSpecFromURL(GURL("file:///tmp/test.html"))); 1764 net::GetHostOrSpecFromURL(GURL("file:///tmp/test.html")));
1759 } 1765 }
OLDNEW
« no previous file with comments | « net/base/net_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698