Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / platform / weborigin / KnownPortsTest.cpp
blob1c6287e7fc58831d9d8ed02ec73eea16e65425d4
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.
5 #include "config.h"
6 #include "platform/weborigin/KnownPorts.h"
8 #include <gtest/gtest.h>
10 namespace blink {
12 TEST(KnownPortsTest, IsDefaultPortForProtocol)
14 struct TestCase {
15 const unsigned short port;
16 const char* protocol;
17 const bool isKnown;
18 } inputs[] = {
19 // Known ones.
20 { 80, "http", true },
21 { 443, "https", true },
22 { 80, "ws", true },
23 { 443, "wss", true },
24 { 21, "ftp", true },
25 { 990, "ftps", true },
27 // Unknown ones.
28 { 5, "foo", false },
29 { 80, "http:", false },
30 { 443, "http", false },
31 { 21, "ftps", false },
32 { 990, "ftp", false },
34 // With upper cases.
35 { 80, "HTTP", false },
36 { 443, "Https", false },
39 for (const TestCase& test : inputs) {
40 bool result = isDefaultPortForProtocol(test.port, test.protocol);
41 EXPECT_EQ(test.isKnown, result);
45 TEST(KnownPortsTest, DefaultPortForProtocol)
47 struct TestCase {
48 const unsigned short port;
49 const char* protocol;
50 } inputs[] = {
51 // Known ones.
52 { 80, "http"},
53 { 443, "https"},
54 { 80, "ws"},
55 { 443, "wss"},
56 { 21, "ftp"},
57 { 990, "ftps"},
59 // Unknown ones.
60 { 0, "foo"},
61 { 0, "http:"},
62 { 0, "HTTP"},
63 { 0, "Https"},
66 for (const TestCase& test : inputs)
67 EXPECT_EQ(test.port, defaultPortForProtocol(test.protocol));
71 } // namespace blink