OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <errno.h> | 5 #include <errno.h> |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "third_party/icu/source/common/unicode/ucnv.h" | 8 #include "third_party/icu/source/common/unicode/ucnv.h" |
9 #include "url/url_canon.h" | 9 #include "url/url_canon.h" |
10 #include "url/url_canon_icu.h" | 10 #include "url/url_canon_icu.h" |
(...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1716 output.Complete(); | 1716 output.Complete(); |
1717 | 1717 |
1718 EXPECT_TRUE(success); | 1718 EXPECT_TRUE(success); |
1719 EXPECT_EQ(path_cases[i].expected, out_str); | 1719 EXPECT_EQ(path_cases[i].expected, out_str); |
1720 | 1720 |
1721 EXPECT_EQ(0, out_parsed.host.begin); | 1721 EXPECT_EQ(0, out_parsed.host.begin); |
1722 EXPECT_EQ(-1, out_parsed.host.len); | 1722 EXPECT_EQ(-1, out_parsed.host.len); |
1723 | 1723 |
1724 // When we end with a colon at the end, there should be no path. | 1724 // When we end with a colon at the end, there should be no path. |
1725 if (path_cases[i].input[url_len - 1] == ':') { | 1725 if (path_cases[i].input[url_len - 1] == ':') { |
1726 EXPECT_EQ(0, out_parsed.path.begin); | 1726 EXPECT_EQ(0, out_parsed.Content().begin); |
1727 EXPECT_EQ(-1, out_parsed.path.len); | 1727 EXPECT_EQ(-1, out_parsed.Content().len); |
1728 } | 1728 } |
1729 } | 1729 } |
1730 } | 1730 } |
1731 | 1731 |
1732 TEST(URLCanonTest, CanonicalizeMailtoURL) { | 1732 TEST(URLCanonTest, CanonicalizeMailtoURL) { |
1733 struct URLCase { | 1733 struct URLCase { |
1734 const char* input; | 1734 const char* input; |
1735 const char* expected; | 1735 const char* expected; |
1736 bool expected_success; | 1736 bool expected_success; |
1737 url_parse::Component expected_path; | 1737 url_parse::Component expected_path; |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2099 url_canon::StdStringCanonOutput repl_output(&repl_str); | 2099 url_canon::StdStringCanonOutput repl_output(&repl_str); |
2100 url_canon::ReplaceFileURL(src, parsed, repl, NULL, &repl_output, &repl_parsed)
; | 2100 url_canon::ReplaceFileURL(src, parsed, repl, NULL, &repl_output, &repl_parsed)
; |
2101 repl_output.Complete(); | 2101 repl_output.Complete(); |
2102 | 2102 |
2103 // Generate the expected string and check. | 2103 // Generate the expected string and check. |
2104 std::string expected("file:///foo?"); | 2104 std::string expected("file:///foo?"); |
2105 for (size_t i = 0; i < new_query.length(); i++) | 2105 for (size_t i = 0; i < new_query.length(); i++) |
2106 expected.push_back('a'); | 2106 expected.push_back('a'); |
2107 EXPECT_TRUE(expected == repl_str); | 2107 EXPECT_TRUE(expected == repl_str); |
2108 } | 2108 } |
OLD | NEW |