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

Unified Diff: url/url_canon_unittest.cc

Issue 2403713002: Add suborigin logic to url::Origin (Closed)
Patch Set: Address Mike's comments Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: url/url_canon_unittest.cc
diff --git a/url/url_canon_unittest.cc b/url/url_canon_unittest.cc
index dfb3dfe1c4dd63ac05fab67cfac244bfcfc0e952..ef11e2242bafd47ec8c219e97206779e57830686 100644
--- a/url/url_canon_unittest.cc
+++ b/url/url_canon_unittest.cc
@@ -2173,4 +2173,36 @@ TEST(URLCanonTest, ReplacementOverflow) {
EXPECT_TRUE(expected == repl_str);
}
+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
+ struct TestCases {
+ const std::string scheme;
+ const int expected_port;
+ } cases[]{
+ {"http", 80},
+ {"https", 443},
+ {"ftp", 21},
+ {"ws", 80},
+ {"wss", 443},
+ {"gopher", 70},
+ {"http-so", 80},
+ {"https-so", 443},
+ {"fake-scheme", PORT_UNSPECIFIED},
+ {"HTTP", PORT_UNSPECIFIED},
+ {"HTTPS", PORT_UNSPECIFIED},
+ {"FTP", PORT_UNSPECIFIED},
+ {"WS", PORT_UNSPECIFIED},
+ {"WSS", PORT_UNSPECIFIED},
+ {"GOPHER", PORT_UNSPECIFIED},
+ {"HTTP-SO", PORT_UNSPECIFIED},
+ {"HTTPS-SO", PORT_UNSPECIFIED},
+ };
+
+ for (auto& test_case : cases) {
+ SCOPED_TRACE(test_case.scheme);
+ EXPECT_EQ(test_case.expected_port,
+ DefaultPortForScheme(test_case.scheme.c_str(),
+ test_case.scheme.size()));
+ }
+}
+
} // namespace url
« url/origin.cc ('K') | « url/url_canon_stdurl.cc ('k') | url/url_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698