| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 { "[::1]", "http", | 101 { "[::1]", "http", |
| 102 url_parse::Component(), // scheme | 102 url_parse::Component(), // scheme |
| 103 url_parse::Component(), // username | 103 url_parse::Component(), // username |
| 104 url_parse::Component(), // password | 104 url_parse::Component(), // password |
| 105 url_parse::Component(0, 5), // host | 105 url_parse::Component(0, 5), // host |
| 106 url_parse::Component(), // port | 106 url_parse::Component(), // port |
| 107 url_parse::Component(), // path | 107 url_parse::Component(), // path |
| 108 url_parse::Component(), // query | 108 url_parse::Component(), // query |
| 109 url_parse::Component(), // ref | 109 url_parse::Component(), // ref |
| 110 }, | 110 }, |
| 111 // Incomplete IPv6 addresses (will not canonicalize). |
| 112 { "[2001:4860:", "http", |
| 113 url_parse::Component(), // scheme |
| 114 url_parse::Component(), // username |
| 115 url_parse::Component(), // password |
| 116 url_parse::Component(0, 11), // host |
| 117 url_parse::Component(), // port |
| 118 url_parse::Component(), // path |
| 119 url_parse::Component(), // query |
| 120 url_parse::Component(), // ref |
| 121 }, |
| 122 { "[2001:4860:/foo", "http", |
| 123 url_parse::Component(), // scheme |
| 124 url_parse::Component(), // username |
| 125 url_parse::Component(), // password |
| 126 url_parse::Component(0, 11), // host |
| 127 url_parse::Component(), // port |
| 128 url_parse::Component(11, 4), // path |
| 129 url_parse::Component(), // query |
| 130 url_parse::Component(), // ref |
| 131 }, |
| 132 { "http://:b005::68]", "http", |
| 133 url_parse::Component(0, 4), // scheme |
| 134 url_parse::Component(), // username |
| 135 url_parse::Component(), // password |
| 136 url_parse::Component(7, 10), // host |
| 137 url_parse::Component(), // port |
| 138 url_parse::Component(), // path |
| 139 url_parse::Component(), // query |
| 140 url_parse::Component(), // ref |
| 141 }, |
| 142 // Can't do anything useful with this. |
| 143 { ":b005::68]", "", |
| 144 url_parse::Component(0, 0), // scheme |
| 145 url_parse::Component(), // username |
| 146 url_parse::Component(), // password |
| 147 url_parse::Component(), // host |
| 148 url_parse::Component(), // port |
| 149 url_parse::Component(), // path |
| 150 url_parse::Component(), // query |
| 151 url_parse::Component(), // ref |
| 152 }, |
| 111 }; | 153 }; |
| 112 | 154 |
| 113 TEST(URLFixerUpperTest, SegmentURL) { | 155 TEST(URLFixerUpperTest, SegmentURL) { |
| 114 std::string result; | 156 std::string result; |
| 115 url_parse::Parsed parts; | 157 url_parse::Parsed parts; |
| 116 | 158 |
| 117 for (size_t i = 0; i < arraysize(segment_cases); ++i) { | 159 for (size_t i = 0; i < arraysize(segment_cases); ++i) { |
| 118 segment_case value = segment_cases[i]; | 160 segment_case value = segment_cases[i]; |
| 119 result = URLFixerUpper::SegmentURL(value.input, &parts); | 161 result = URLFixerUpper::SegmentURL(value.input, &parts); |
| 120 EXPECT_EQ(value.result, result); | 162 EXPECT_EQ(value.result, result); |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 // (should resolve to the same file as above) | 440 // (should resolve to the same file as above) |
| 399 relative_file_str = sub_dir.value() + FILE_PATH_LITERAL("/../") + | 441 relative_file_str = sub_dir.value() + FILE_PATH_LITERAL("/../") + |
| 400 sub_dir.value() + FILE_PATH_LITERAL("///./") + sub_file.value(); | 442 sub_dir.value() + FILE_PATH_LITERAL("///./") + sub_file.value(); |
| 401 fixedup = URLFixerUpper::FixupRelativeFile(dir, FilePath(relative_file_str)); | 443 fixedup = URLFixerUpper::FixupRelativeFile(dir, FilePath(relative_file_str)); |
| 402 EXPECT_TRUE(IsMatchingFileURL(fixedup, full_path)); | 444 EXPECT_TRUE(IsMatchingFileURL(fixedup, full_path)); |
| 403 | 445 |
| 404 // done with the subdir | 446 // done with the subdir |
| 405 EXPECT_TRUE(file_util::Delete(full_path, false)); | 447 EXPECT_TRUE(file_util::Delete(full_path, false)); |
| 406 EXPECT_TRUE(file_util::Delete(new_dir, true)); | 448 EXPECT_TRUE(file_util::Delete(new_dir, true)); |
| 407 } | 449 } |
| OLD | NEW |