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

Side by Side Diff: chrome/browser/net/url_fixer_upper_unittest.cc

Issue 7064052: Revert 88142 to fix sync_integration_tests offline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 6 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
OLDNEW
1 // Copyright (c) 2011 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 <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 url_parse::Component(7, 14), // host 50 url_parse::Component(7, 14), // host
51 url_parse::Component(), // port 51 url_parse::Component(), // port
52 url_parse::Component(21, 1), // path 52 url_parse::Component(21, 1), // path
53 url_parse::Component(), // query 53 url_parse::Component(), // query
54 url_parse::Component(), // ref 54 url_parse::Component(), // ref
55 }, 55 },
56 { "aBoUt:vErSiOn", "about", 56 { "aBoUt:vErSiOn", "about",
57 url_parse::Component(0, 5), // scheme 57 url_parse::Component(0, 5), // scheme
58 url_parse::Component(), // username 58 url_parse::Component(), // username
59 url_parse::Component(), // password 59 url_parse::Component(), // password
60 url_parse::Component(6, 7), // host 60 url_parse::Component(), // host
61 url_parse::Component(), // port 61 url_parse::Component(), // port
62 url_parse::Component(), // path 62 url_parse::Component(), // path
63 url_parse::Component(), // query 63 url_parse::Component(), // query
64 url_parse::Component(), // ref 64 url_parse::Component(), // ref
65 }, 65 },
66 { "about:host/path?query#ref", "about",
67 url_parse::Component(0, 5), // scheme
68 url_parse::Component(), // username
69 url_parse::Component(), // password
70 url_parse::Component(6, 4), // host
71 url_parse::Component(), // port
72 url_parse::Component(10, 5), // path
73 url_parse::Component(16, 5), // query
74 url_parse::Component(22, 3), // ref
75 },
76 { "about://host/path?query#ref", "about",
77 url_parse::Component(0, 5), // scheme
78 url_parse::Component(), // username
79 url_parse::Component(), // password
80 url_parse::Component(8, 4), // host
81 url_parse::Component(), // port
82 url_parse::Component(12, 5), // path
83 url_parse::Component(18, 5), // query
84 url_parse::Component(24, 3), // ref
85 },
86 { "chrome:host/path?query#ref", "chrome",
87 url_parse::Component(0, 6), // scheme
88 url_parse::Component(), // username
89 url_parse::Component(), // password
90 url_parse::Component(7, 4), // host
91 url_parse::Component(), // port
92 url_parse::Component(11, 5), // path
93 url_parse::Component(17, 5), // query
94 url_parse::Component(23, 3), // ref
95 },
96 { "chrome://host/path?query#ref", "chrome",
97 url_parse::Component(0, 6), // scheme
98 url_parse::Component(), // username
99 url_parse::Component(), // password
100 url_parse::Component(9, 4), // host
101 url_parse::Component(), // port
102 url_parse::Component(13, 5), // path
103 url_parse::Component(19, 5), // query
104 url_parse::Component(25, 3), // ref
105 },
106 { " www.google.com:124?foo#", "http", 66 { " www.google.com:124?foo#", "http",
107 url_parse::Component(), // scheme 67 url_parse::Component(), // scheme
108 url_parse::Component(), // username 68 url_parse::Component(), // username
109 url_parse::Component(), // password 69 url_parse::Component(), // password
110 url_parse::Component(4, 14), // host 70 url_parse::Component(4, 14), // host
111 url_parse::Component(19, 3), // port 71 url_parse::Component(19, 3), // port
112 url_parse::Component(), // path 72 url_parse::Component(), // path
113 url_parse::Component(23, 3), // query 73 url_parse::Component(23, 3), // query
114 url_parse::Component(27, 0), // ref 74 url_parse::Component(27, 0), // ref
115 }, 75 },
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 const std::string output; 211 const std::string output;
252 } fixup_cases[] = { 212 } fixup_cases[] = {
253 {"www.google.com", "", "http://www.google.com/"}, 213 {"www.google.com", "", "http://www.google.com/"},
254 {" www.google.com ", "", "http://www.google.com/"}, 214 {" www.google.com ", "", "http://www.google.com/"},
255 {" foo.com/asdf bar", "", "http://foo.com/asdf%20%20bar"}, 215 {" foo.com/asdf bar", "", "http://foo.com/asdf%20%20bar"},
256 {"..www.google.com..", "", "http://www.google.com./"}, 216 {"..www.google.com..", "", "http://www.google.com./"},
257 {"http://......", "", "http://....../"}, 217 {"http://......", "", "http://....../"},
258 {"http://host.com:ninety-two/", "", "http://host.com:ninety-two/"}, 218 {"http://host.com:ninety-two/", "", "http://host.com:ninety-two/"},
259 {"http://host.com:ninety-two?foo", "", "http://host.com:ninety-two/?foo"}, 219 {"http://host.com:ninety-two?foo", "", "http://host.com:ninety-two/?foo"},
260 {"google.com:123", "", "http://google.com:123/"}, 220 {"google.com:123", "", "http://google.com:123/"},
261 {"about:", "", "chrome://version/"}, 221 {"about:", "", "about:"},
262 {"about:foo", "", "chrome://foo/"}, 222 {"about:version", "", "about:version"},
263 {"about:version", "", "chrome://version/"},
264 {"about:usr:pwd@hst/pth?qry#ref", "", "chrome://usr:pwd@hst/pth?qry#ref"},
265 {"about://usr:pwd@hst/pth?qry#ref", "", "chrome://usr:pwd@hst/pth?qry#ref"},
266 {"chrome:usr:pwd@hst/pth?qry#ref", "", "chrome://usr:pwd@hst/pth?qry#ref"},
267 {"chrome://usr:pwd@hst/pth?qry#ref", "", "chrome://usr:pwd@hst/pth?qry#ref"},
268 {"www:123", "", "http://www:123/"}, 223 {"www:123", "", "http://www:123/"},
269 {" www:123", "", "http://www:123/"}, 224 {" www:123", "", "http://www:123/"},
270 {"www.google.com?foo", "", "http://www.google.com/?foo"}, 225 {"www.google.com?foo", "", "http://www.google.com/?foo"},
271 {"www.google.com#foo", "", "http://www.google.com/#foo"}, 226 {"www.google.com#foo", "", "http://www.google.com/#foo"},
272 {"www.google.com?", "", "http://www.google.com/?"}, 227 {"www.google.com?", "", "http://www.google.com/?"},
273 {"www.google.com#", "", "http://www.google.com/#"}, 228 {"www.google.com#", "", "http://www.google.com/#"},
274 {"www.google.com:123?foo#bar", "", "http://www.google.com:123/?foo#bar"}, 229 {"www.google.com:123?foo#bar", "", "http://www.google.com:123/?foo#bar"},
275 {"user@www.google.com", "", "http://user@www.google.com/"}, 230 {"user@www.google.com", "", "http://user@www.google.com/"},
276 {"\xE6\xB0\xB4.com" , "", "http://xn--1rw.com/"}, 231 {"\xE6\xB0\xB4.com" , "", "http://xn--1rw.com/"},
277 // It would be better if this next case got treated as http, but I don't see 232 // It would be better if this next case got treated as http, but I don't see
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 // (should resolve to the same file as above) 465 // (should resolve to the same file as above)
511 relative_file_str = sub_dir.value() + FILE_PATH_LITERAL("/../") + 466 relative_file_str = sub_dir.value() + FILE_PATH_LITERAL("/../") +
512 sub_dir.value() + FILE_PATH_LITERAL("///./") + sub_file.value(); 467 sub_dir.value() + FILE_PATH_LITERAL("///./") + sub_file.value();
513 EXPECT_TRUE(IsMatchingFileURL(URLFixerUpper::FixupRelativeFile(dir, 468 EXPECT_TRUE(IsMatchingFileURL(URLFixerUpper::FixupRelativeFile(dir,
514 FilePath(relative_file_str)).possibly_invalid_spec(), full_path)); 469 FilePath(relative_file_str)).possibly_invalid_spec(), full_path));
515 470
516 // done with the subdir 471 // done with the subdir
517 EXPECT_TRUE(file_util::Delete(full_path, false)); 472 EXPECT_TRUE(file_util::Delete(full_path, false));
518 EXPECT_TRUE(file_util::Delete(new_dir, true)); 473 EXPECT_TRUE(file_util::Delete(new_dir, true));
519 } 474 }
OLDNEW
« no previous file with comments | « chrome/browser/net/url_fixer_upper.cc ('k') | chrome/browser/net/view_blob_internals_job_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698