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

Side by Side Diff: components/url_formatter/url_fixer_unittest.cc

Issue 1942613002: Change semicolon replace logic in url_fixer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | « components/url_formatter/url_fixer.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 7
8 #include "base/base_paths.h" 8 #include "base/base_paths.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 // URLs containing IPv6 literals. 295 // URLs containing IPv6 literals.
296 {"[2001:db8::2]", "http://[2001:db8::2]/"}, 296 {"[2001:db8::2]", "http://[2001:db8::2]/"},
297 {"[::]:80", "http://[::]/"}, 297 {"[::]:80", "http://[::]/"},
298 {"[::]:80/path", "http://[::]/path"}, 298 {"[::]:80/path", "http://[::]/path"},
299 {"[::]:180/path", "http://[::]:180/path"}, 299 {"[::]:180/path", "http://[::]:180/path"},
300 // TODO(pmarks): Maybe we should parse bare IPv6 literals someday. 300 // TODO(pmarks): Maybe we should parse bare IPv6 literals someday.
301 {"::1", "::1"}, 301 {"::1", "::1"},
302 // Semicolon as scheme separator for standard schemes. 302 // Semicolon as scheme separator for standard schemes.
303 {"http;//www.google.com/", "http://www.google.com/"}, 303 {"http;//www.google.com/", "http://www.google.com/"},
304 {"about;chrome", "chrome://chrome/"}, 304 {"about;chrome", "chrome://chrome/"},
305 // Semicolon left as-is for non-standard schemes. 305 // Semicolon in non-standard schemes is not replaced by colon.
306 {"whatsup;//fool", "whatsup://fool"}, 306 {"whatsup;//fool", "http://whatsup%3B//fool"},
307 // Semicolon left as-is in URL itself. 307 // Semicolon left as-is in URL itself.
308 {"http://host/port?query;moar", "http://host/port?query;moar"}, 308 {"http://host/port?query;moar", "http://host/port?query;moar"},
309 // Fewer slashes than expected. 309 // Fewer slashes than expected.
310 {"http;www.google.com/", "http://www.google.com/"}, 310 {"http;www.google.com/", "http://www.google.com/"},
311 {"http;/www.google.com/", "http://www.google.com/"}, 311 {"http;/www.google.com/", "http://www.google.com/"},
312 // Semicolon at start. 312 // Semicolon at start.
313 {";http://www.google.com/", "http://%3Bhttp//www.google.com/"}, 313 {";http://www.google.com/", "http://%3Bhttp//www.google.com/"},
314 }; 314 };
315 315
316 TEST(URLFixerTest, FixupURL) { 316 TEST(URLFixerTest, FixupURL) {
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 EXPECT_TRUE(base::DeleteFile(full_path, false)); 530 EXPECT_TRUE(base::DeleteFile(full_path, false));
531 EXPECT_TRUE(base::DeleteFile(new_dir, true)); 531 EXPECT_TRUE(base::DeleteFile(new_dir, true));
532 532
533 // Test that an obvious HTTP URL isn't accidentally treated as an absolute 533 // Test that an obvious HTTP URL isn't accidentally treated as an absolute
534 // file path (on account of system-specific craziness). 534 // file path (on account of system-specific craziness).
535 base::FilePath empty_path; 535 base::FilePath empty_path;
536 base::FilePath http_url_path(FILE_PATH_LITERAL("http://../")); 536 base::FilePath http_url_path(FILE_PATH_LITERAL("http://../"));
537 EXPECT_TRUE(url_formatter::FixupRelativeFile(empty_path, http_url_path) 537 EXPECT_TRUE(url_formatter::FixupRelativeFile(empty_path, http_url_path)
538 .SchemeIs("http")); 538 .SchemeIs("http"));
539 } 539 }
OLDNEW
« no previous file with comments | « components/url_formatter/url_fixer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698