OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/child/blink_platform_impl.h" | 5 #include "content/child/blink_platform_impl.h" |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "net/base/net_util.h" | 9 #include "net/base/net_util.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 #include "third_party/WebKit/public/platform/WebString.h" | 11 #include "third_party/WebKit/public/platform/WebString.h" |
12 | |
eroman
2015/04/13 15:55:35
Remove this blank line
| |
12 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" | 13 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 | 16 |
16 // Derives BlinkPlatformImpl for testing shared timers. | 17 // Derives BlinkPlatformImpl for testing shared timers. |
17 class TestBlinkPlatformImpl : public BlinkPlatformImpl { | 18 class TestBlinkPlatformImpl : public BlinkPlatformImpl { |
18 public: | 19 public: |
19 TestBlinkPlatformImpl() : mock_monotonically_increasing_time_(0) {} | 20 TestBlinkPlatformImpl() : mock_monotonically_increasing_time_(0) {} |
20 | 21 |
21 // Returns mock time when enabled. | 22 // Returns mock time when enabled. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 if (i == 0 || i == 10 || i == 127 || i > 223) { | 114 if (i == 0 || i == 10 || i == 127 || i > 223) { |
114 EXPECT_TRUE(platform_impl.isReservedIPAddress( | 115 EXPECT_TRUE(platform_impl.isReservedIPAddress( |
115 blink::WebString::fromUTF8(addressString))); | 116 blink::WebString::fromUTF8(addressString))); |
116 } else { | 117 } else { |
117 EXPECT_FALSE(platform_impl.isReservedIPAddress( | 118 EXPECT_FALSE(platform_impl.isReservedIPAddress( |
118 blink::WebString::fromUTF8(addressString))); | 119 blink::WebString::fromUTF8(addressString))); |
119 } | 120 } |
120 } | 121 } |
121 } | 122 } |
122 | 123 |
124 TEST(BlinkPlatformTest, portAllowed) { | |
125 TestBlinkPlatformImpl platform_impl; | |
tyoshino (SeeGerritForStatus)
2015/04/13 14:28:16
two space indent
| |
126 EXPECT_TRUE(platform_impl.portAllowed(GURL("example.com"))); | |
127 EXPECT_TRUE(platform_impl.portAllowed(GURL("file://example.com"))); | |
eroman
2015/04/13 15:55:35
please also add a test for file:// containing "por
| |
128 EXPECT_TRUE(platform_impl.portAllowed(GURL("ftp://example.com:21"))); | |
129 EXPECT_FALSE(platform_impl.portAllowed(GURL("ftp://example.com:87"))); | |
130 EXPECT_FALSE(platform_impl.portAllowed(GURL("ws://example.com:21"))); | |
131 EXPECT_TRUE(platform_impl.portAllowed(GURL("http://example.com:80"))); | |
eroman
2015/04/13 15:55:35
please include tests which contain no explicitly s
| |
132 } | |
133 | |
123 } // namespace content | 134 } // namespace content |
OLD | NEW |