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 #include <stddef.h> | 6 #include <stddef.h> |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "url/third_party/mozilla/url_parse.h" | 10 #include "url/third_party/mozilla/url_parse.h" |
(...skipping 2155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2166 ReplaceFileURL(src, parsed, repl, NULL, &repl_output, &repl_parsed); | 2166 ReplaceFileURL(src, parsed, repl, NULL, &repl_output, &repl_parsed); |
2167 repl_output.Complete(); | 2167 repl_output.Complete(); |
2168 | 2168 |
2169 // Generate the expected string and check. | 2169 // Generate the expected string and check. |
2170 std::string expected("file:///foo?"); | 2170 std::string expected("file:///foo?"); |
2171 for (size_t i = 0; i < new_query.length(); i++) | 2171 for (size_t i = 0; i < new_query.length(); i++) |
2172 expected.push_back('a'); | 2172 expected.push_back('a'); |
2173 EXPECT_TRUE(expected == repl_str); | 2173 EXPECT_TRUE(expected == repl_str); |
2174 } | 2174 } |
2175 | 2175 |
2176 TEST(URLCanonTest, DefaultPortForScheme) { | |
nasko
2016/10/13 22:16:45
Hmm, this test case doesn't belong logically with
jww
2016/10/14 01:08:58
How so? I added Suborigins to DefaultPortForScheme
nasko
2016/10/14 14:12:41
It is totally fine if you want to commit it this w
| |
2177 struct TestCases { | |
2178 const std::string scheme; | |
2179 const int expected_port; | |
2180 } cases[]{ | |
2181 {"http", 80}, | |
2182 {"https", 443}, | |
2183 {"ftp", 21}, | |
2184 {"ws", 80}, | |
2185 {"wss", 443}, | |
2186 {"gopher", 70}, | |
2187 {"http-so", 80}, | |
2188 {"https-so", 443}, | |
2189 {"fake-scheme", PORT_UNSPECIFIED}, | |
2190 {"HTTP", PORT_UNSPECIFIED}, | |
2191 {"HTTPS", PORT_UNSPECIFIED}, | |
2192 {"FTP", PORT_UNSPECIFIED}, | |
2193 {"WS", PORT_UNSPECIFIED}, | |
2194 {"WSS", PORT_UNSPECIFIED}, | |
2195 {"GOPHER", PORT_UNSPECIFIED}, | |
2196 {"HTTP-SO", PORT_UNSPECIFIED}, | |
2197 {"HTTPS-SO", PORT_UNSPECIFIED}, | |
2198 }; | |
2199 | |
2200 for (auto& test_case : cases) { | |
2201 SCOPED_TRACE(test_case.scheme); | |
2202 EXPECT_EQ(test_case.expected_port, | |
2203 DefaultPortForScheme(test_case.scheme.c_str(), | |
2204 test_case.scheme.size())); | |
2205 } | |
2206 } | |
2207 | |
2176 } // namespace url | 2208 } // namespace url |
OLD | NEW |