| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 TEST(BlinkPlatformTest, WebSecurityOriginNormalization) { | 148 TEST(BlinkPlatformTest, WebSecurityOriginNormalization) { |
| 149 struct TestCases { | 149 struct TestCases { |
| 150 const char* url; | 150 const char* url; |
| 151 } cases[] = {{""}, | 151 } cases[] = {{""}, |
| 152 {"javascript:alert(1)"}, | 152 {"javascript:alert(1)"}, |
| 153 {"file://example.com:443/etc/passwd"}, | 153 {"file://example.com:443/etc/passwd"}, |
| 154 {"blob:https://example.com/uuid-goes-here"}, | 154 {"blob:https://example.com/uuid-goes-here"}, |
| 155 {"filesystem:https://example.com/temporary/yay.png"}, | 155 {"filesystem:https://example.com/temporary/yay.png"}, |
| 156 {"data"}, | 156 {"data"}, |
| 157 {"blob:"}, | 157 {"blob:"}, |
| 158 {"chrome://,/"}, |
| 158 {"xkcd://927"}, | 159 {"xkcd://927"}, |
| 159 {"filesystem"}, | 160 {"filesystem"}, |
| 160 {"data://example.com:80"}, | 161 {"data://example.com:80"}, |
| 161 {"http://☃.net:80"}, | 162 {"http://☃.net:80"}, |
| 162 {"http\nmore://example.com:80"}, | 163 {"http\nmore://example.com:80"}, |
| 163 {"http\rmore://:example.com:80"}, | 164 {"http\rmore://:example.com:80"}, |
| 164 {"http\n://example.com:80"}, | 165 {"http\n://example.com:80"}, |
| 165 {"http\r://example.com:80"}, | 166 {"http\r://example.com:80"}, |
| 166 {"http://example.com\nnot-example.com:80"}, | 167 {"http://example.com\nnot-example.com:80"}, |
| 167 {"http://example.com\rnot-example.com:80"}, | 168 {"http://example.com\rnot-example.com:80"}, |
| 168 {"http://example.com\n:80"}, | 169 {"http://example.com\n:80"}, |
| 169 {"http://example.com\r:80"}, | 170 {"http://example.com\r:80"}, |
| 170 {"http://example.com:0"}, | 171 {"http://example.com:0"}, |
| 171 {"http://EXAMPLE.com"}, | 172 {"http://EXAMPLE.com"}, |
| 172 {"http://EXAMPLE.com/%3Afoo"}, | 173 {"http://EXAMPLE.com/%3Afoo"}, |
| 173 {"https://example.com:443"}, | 174 {"https://example.com:443"}, |
| 174 {"file:///"}, | 175 {"file:///"}, |
| 175 {"file:///root:80"}}; | 176 {"file:///root:80"}}; |
| 176 | 177 |
| 177 for (const auto& test : cases) { | 178 for (const auto& test : cases) { |
| 178 SCOPED_TRACE(testing::Message() << test.url); | 179 SCOPED_TRACE(testing::Message() << test.url); |
| 179 blink::WebSecurityOrigin web_origin = | 180 blink::WebSecurityOrigin web_origin = |
| 180 blink::WebSecurityOrigin::createFromString( | 181 blink::WebSecurityOrigin::createFromString( |
| 181 blink::WebString::fromUTF8(test.url)); | 182 blink::WebString::fromUTF8(test.url)); |
| 182 CheckCastedOriginsAlreadyNormalized(web_origin); | 183 CheckCastedOriginsAlreadyNormalized(web_origin); |
| 183 } | 184 } |
| 184 } | 185 } |
| 185 | 186 |
| 186 } // namespace content | 187 } // namespace content |
| OLD | NEW |