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 2166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2177 struct TestCases { | 2177 struct TestCases { |
2178 const char* scheme; | 2178 const char* scheme; |
2179 const int expected_port; | 2179 const int expected_port; |
2180 } cases[]{ | 2180 } cases[]{ |
2181 {"http", 80}, | 2181 {"http", 80}, |
2182 {"https", 443}, | 2182 {"https", 443}, |
2183 {"ftp", 21}, | 2183 {"ftp", 21}, |
2184 {"ws", 80}, | 2184 {"ws", 80}, |
2185 {"wss", 443}, | 2185 {"wss", 443}, |
2186 {"gopher", 70}, | 2186 {"gopher", 70}, |
| 2187 {"http-so", 80}, |
| 2188 {"https-so", 443}, |
2187 {"fake-scheme", PORT_UNSPECIFIED}, | 2189 {"fake-scheme", PORT_UNSPECIFIED}, |
2188 {"HTTP", PORT_UNSPECIFIED}, | 2190 {"HTTP", PORT_UNSPECIFIED}, |
2189 {"HTTPS", PORT_UNSPECIFIED}, | 2191 {"HTTPS", PORT_UNSPECIFIED}, |
2190 {"FTP", PORT_UNSPECIFIED}, | 2192 {"FTP", PORT_UNSPECIFIED}, |
2191 {"WS", PORT_UNSPECIFIED}, | 2193 {"WS", PORT_UNSPECIFIED}, |
2192 {"WSS", PORT_UNSPECIFIED}, | 2194 {"WSS", PORT_UNSPECIFIED}, |
2193 {"GOPHER", PORT_UNSPECIFIED}, | 2195 {"GOPHER", PORT_UNSPECIFIED}, |
| 2196 {"HTTP-SO", PORT_UNSPECIFIED}, |
| 2197 {"HTTPS-SO", PORT_UNSPECIFIED}, |
2194 }; | 2198 }; |
2195 | 2199 |
2196 for (auto& test_case : cases) { | 2200 for (auto& test_case : cases) { |
2197 SCOPED_TRACE(test_case.scheme); | 2201 SCOPED_TRACE(test_case.scheme); |
2198 EXPECT_EQ(test_case.expected_port, | 2202 EXPECT_EQ(test_case.expected_port, |
2199 DefaultPortForScheme(test_case.scheme, strlen(test_case.scheme))); | 2203 DefaultPortForScheme(test_case.scheme, strlen(test_case.scheme))); |
2200 } | 2204 } |
2201 } | 2205 } |
2202 | 2206 |
2203 } // namespace url | 2207 } // namespace url |
OLD | NEW |