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

Side by Side Diff: Source/platform/weborigin/KnownPortsTest.cpp

Issue 1074913004: Simplify protocol name and port comparison in KnwonPorts.cpp (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: added upper-case test case Created 5 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/platform/weborigin/KnownPorts.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "platform/weborigin/KnownPorts.h"
7
8 #include <gtest/gtest.h>
9
10 using blink::isDefaultPortForProtocol;
11
12 namespace {
13
14 TEST(KnownPortsTest, IsDefaultPortForProtocol)
15 {
16 struct TestCase {
17 const unsigned short port;
18 const char* protocol;
19 const bool isKnown;
20 };
21
22 TestCase inputs[] = {
23 // Known ones.
24 { 80, "http", true },
25 { 443, "https", true },
26 { 21, "ftp", true },
27 { 990, "ftps", true },
28
29 // Unknown ones.
30 { 5, "foo", false },
31 { 80, "http:", false },
32 { 443, "http", false },
33 { 21, "ftps", false },
34 { 990, "ftp", false },
35
36 // With upper cases.
37 { 80, "HTTP", false },
38 { 443, "Https", false },
39 };
40
41 for (TestCase test : inputs) {
42 bool result = isDefaultPortForProtocol(test.port, test.protocol);
43 EXPECT_EQ(test.isKnown, result);
44 }
45 }
46
47 }
OLDNEW
« no previous file with comments | « Source/platform/weborigin/KnownPorts.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698