| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 TEST(BlinkPlatformTest, WebSecurityOriginNormalization) { | 124 TEST(BlinkPlatformTest, WebSecurityOriginNormalization) { |
| 125 struct TestCases { | 125 struct TestCases { |
| 126 const char* url; | 126 const char* url; |
| 127 } cases[] = {{""}, | 127 } cases[] = {{""}, |
| 128 {"javascript:alert(1)"}, | 128 {"javascript:alert(1)"}, |
| 129 {"file://example.com:443/etc/passwd"}, | 129 {"file://example.com:443/etc/passwd"}, |
| 130 {"blob:https://example.com/uuid-goes-here"}, | 130 {"blob:https://example.com/uuid-goes-here"}, |
| 131 {"filesystem:https://example.com/temporary/yay.png"}, | 131 {"filesystem:https://example.com/temporary/yay.png"}, |
| 132 {"data"}, | 132 {"data"}, |
| 133 {"blob:"}, | 133 {"blob:"}, |
| 134 {"chrome://,/"}, |
| 134 {"xkcd://927"}, | 135 {"xkcd://927"}, |
| 135 {"filesystem"}, | 136 {"filesystem"}, |
| 136 {"data://example.com:80"}, | 137 {"data://example.com:80"}, |
| 137 {"http://☃.net:80"}, | 138 {"http://☃.net:80"}, |
| 138 {"http\nmore://example.com:80"}, | 139 {"http\nmore://example.com:80"}, |
| 139 {"http\rmore://:example.com:80"}, | 140 {"http\rmore://:example.com:80"}, |
| 140 {"http\n://example.com:80"}, | 141 {"http\n://example.com:80"}, |
| 141 {"http\r://example.com:80"}, | 142 {"http\r://example.com:80"}, |
| 142 {"http://example.com\nnot-example.com:80"}, | 143 {"http://example.com\nnot-example.com:80"}, |
| 143 {"http://example.com\rnot-example.com:80"}, | 144 {"http://example.com\rnot-example.com:80"}, |
| 144 {"http://example.com\n:80"}, | 145 {"http://example.com\n:80"}, |
| 145 {"http://example.com\r:80"}, | 146 {"http://example.com\r:80"}, |
| 146 {"http://example.com:0"}, | 147 {"http://example.com:0"}, |
| 147 {"http://EXAMPLE.com"}, | 148 {"http://EXAMPLE.com"}, |
| 148 {"http://EXAMPLE.com/%3Afoo"}, | 149 {"http://EXAMPLE.com/%3Afoo"}, |
| 149 {"https://example.com:443"}, | 150 {"https://example.com:443"}, |
| 150 {"file:///"}, | 151 {"file:///"}, |
| 151 {"file:///root:80"}}; | 152 {"file:///root:80"}}; |
| 152 | 153 |
| 153 for (const auto& test : cases) { | 154 for (const auto& test : cases) { |
| 154 SCOPED_TRACE(testing::Message() << test.url); | 155 SCOPED_TRACE(testing::Message() << test.url); |
| 155 blink::WebSecurityOrigin web_origin = | 156 blink::WebSecurityOrigin web_origin = |
| 156 blink::WebSecurityOrigin::createFromString( | 157 blink::WebSecurityOrigin::createFromString( |
| 157 blink::WebString::fromUTF8(test.url)); | 158 blink::WebString::fromUTF8(test.url)); |
| 158 CheckCastedOriginsAlreadyNormalized(web_origin); | 159 CheckCastedOriginsAlreadyNormalized(web_origin); |
| 159 } | 160 } |
| 160 } | 161 } |
| 161 | 162 |
| 162 } // namespace content | 163 } // namespace content |
| OLD | NEW |