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

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

Issue 7068007: Revise about: and chrome: url handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments and add extra crash URL checks. 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) 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 <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"
(...skipping 39 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(), // host 60 url_parse::Component(6, 7), // 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 },
66 { " www.google.com:124?foo#", "http", 106 { " www.google.com:124?foo#", "http",
67 url_parse::Component(), // scheme 107 url_parse::Component(), // scheme
68 url_parse::Component(), // username 108 url_parse::Component(), // username
69 url_parse::Component(), // password 109 url_parse::Component(), // password
70 url_parse::Component(4, 14), // host 110 url_parse::Component(4, 14), // host
71 url_parse::Component(19, 3), // port 111 url_parse::Component(19, 3), // port
72 url_parse::Component(), // path 112 url_parse::Component(), // path
73 url_parse::Component(23, 3), // query 113 url_parse::Component(23, 3), // query
74 url_parse::Component(27, 0), // ref 114 url_parse::Component(27, 0), // ref
75 }, 115 },
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 // (should resolve to the same file as above) 505 // (should resolve to the same file as above)
466 relative_file_str = sub_dir.value() + FILE_PATH_LITERAL("/../") + 506 relative_file_str = sub_dir.value() + FILE_PATH_LITERAL("/../") +
467 sub_dir.value() + FILE_PATH_LITERAL("///./") + sub_file.value(); 507 sub_dir.value() + FILE_PATH_LITERAL("///./") + sub_file.value();
468 EXPECT_TRUE(IsMatchingFileURL(URLFixerUpper::FixupRelativeFile(dir, 508 EXPECT_TRUE(IsMatchingFileURL(URLFixerUpper::FixupRelativeFile(dir,
469 FilePath(relative_file_str)).possibly_invalid_spec(), full_path)); 509 FilePath(relative_file_str)).possibly_invalid_spec(), full_path));
470 510
471 // done with the subdir 511 // done with the subdir
472 EXPECT_TRUE(file_util::Delete(full_path, false)); 512 EXPECT_TRUE(file_util::Delete(full_path, false));
473 EXPECT_TRUE(file_util::Delete(new_dir, true)); 513 EXPECT_TRUE(file_util::Delete(new_dir, true));
474 } 514 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698