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 "config.h" | 5 #include "config.h" |
6 #include "core/loader/MixedContentChecker.h" | 6 #include "core/loader/MixedContentChecker.h" |
7 | 7 |
8 #include "platform/weborigin/KURL.h" | 8 #include "platform/weborigin/KURL.h" |
9 #include "platform/weborigin/SecurityOrigin.h" | 9 #include "platform/weborigin/SecurityOrigin.h" |
10 #include "wtf/RefPtr.h" | 10 #include "wtf/RefPtr.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 {"http://example.com/foo", "http://example.com/foo", false}, | 24 {"http://example.com/foo", "http://example.com/foo", false}, |
25 {"http://example.com/foo", "https://example.com/foo", false}, | 25 {"http://example.com/foo", "https://example.com/foo", false}, |
26 {"https://example.com/foo", "https://example.com/foo", false}, | 26 {"https://example.com/foo", "https://example.com/foo", false}, |
27 {"https://example.com/foo", "wss://example.com/foo", false}, | 27 {"https://example.com/foo", "wss://example.com/foo", false}, |
28 {"https://example.com/foo", "http://example.com/foo", true}, | 28 {"https://example.com/foo", "http://example.com/foo", true}, |
29 {"https://example.com/foo", "http://google.com/foo", true}, | 29 {"https://example.com/foo", "http://google.com/foo", true}, |
30 {"https://example.com/foo", "ws://example.com/foo", true}, | 30 {"https://example.com/foo", "ws://example.com/foo", true}, |
31 {"https://example.com/foo", "ws://google.com/foo", true}, | 31 {"https://example.com/foo", "ws://google.com/foo", true}, |
32 }; | 32 }; |
33 | 33 |
34 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { | 34 for (size_t i = 0; i < arraysize(cases); ++i) { |
35 const char* origin = cases[i].origin; | 35 const char* origin = cases[i].origin; |
36 const char* target = cases[i].target; | 36 const char* target = cases[i].target; |
37 bool expectation = cases[i].expectation; | 37 bool expectation = cases[i].expectation; |
38 | 38 |
39 KURL originUrl(KURL(), origin); | 39 KURL originUrl(KURL(), origin); |
40 RefPtr<SecurityOrigin> securityOrigin(SecurityOrigin::create(originUrl))
; | 40 RefPtr<SecurityOrigin> securityOrigin(SecurityOrigin::create(originUrl))
; |
41 KURL targetUrl(KURL(), target); | 41 KURL targetUrl(KURL(), target); |
42 EXPECT_EQ(expectation, MixedContentChecker::isMixedContent(securityOrigi
n.get(), targetUrl)) << "Origin: " << origin << ", Target: " << target << ", Exp
ectation: " << expectation; | 42 EXPECT_EQ(expectation, MixedContentChecker::isMixedContent(securityOrigi
n.get(), targetUrl)) << "Origin: " << origin << ", Target: " << target << ", Exp
ectation: " << expectation; |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 } // namespace blink | 46 } // namespace blink |
OLD | NEW |