Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Side by Side Diff: content/browser/frame_host/mixed_content_navigation_throttle_unittest.cc

Issue 1905033002: PlzNavigate: Move navigation-level mixed content checks to the browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@console-security-message
Patch Set: Now using shared scheme collections from url_util.h. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 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.
4
5 #include "base/macros.h"
6 #include "content/browser/frame_host/mixed_content_navigation_throttle.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 namespace content {
10
11 // Tests that MixedContentNavigationThrottle correctly detects or ignores many
12 // cases where there is or there is not mixed content, respectively.
13 // Note: Browser side version of MixedContentCheckerTest.IsMixedContent. Must be
14 // kept in sync manually!
15 TEST(MixedContentNavigationThrottleTest, IsMixedContent) {
16 struct TestCase {
17 const char* origin;
18 const char* target;
19 const bool expectation;
nasko 2017/01/23 22:32:38 nit: What is the meaning of "expectation"? Maybe r
carlosk 2017/02/08 02:59:03 Done.
20 } cases[] = {
21 {"http://example.com/foo", "http://example.com/foo", false},
22 {"http://example.com/foo", "https://example.com/foo", false},
23 {"http://example.com/foo", "data:text/html,<p>Hi!</p>", false},
24 {"http://example.com/foo", "about:blank", false},
25 {"https://example.com/foo", "https://example.com/foo", false},
26 {"https://example.com/foo", "wss://example.com/foo", false},
27 {"https://example.com/foo", "data:text/html,<p>Hi!</p>", false},
28 {"https://example.com/foo", "http://127.0.0.1/", false},
29 {"https://example.com/foo", "http://[::1]/", false},
30 {"https://example.com/foo", "blob:https://example.com/foo", false},
31 {"https://example.com/foo", "blob:http://example.com/foo", false},
nasko 2017/01/23 22:32:38 nit: I know this is how the code works, but this j
carlosk 2017/02/08 02:59:03 Acknowledged.
32 {"https://example.com/foo", "blob:null/foo", false},
33 {"https://example.com/foo", "filesystem:https://example.com/foo", false},
34 {"https://example.com/foo", "filesystem:http://example.com/foo", false},
35 {"https://example.com/foo", "filesystem:null/foo", false},
36
37 {"https://example.com/foo", "http://example.com/foo", true},
38 {"https://example.com/foo", "http://google.com/foo", true},
39 {"https://example.com/foo", "ws://example.com/foo", true},
40 {"https://example.com/foo", "ws://google.com/foo", true},
41 {"https://example.com/foo", "http://192.168.1.1/", true},
42 {"https://example.com/foo", "http://localhost/", true},
43 };
44
45 for (const auto& test : cases) {
46 SCOPED_TRACE(::testing::Message() << "Origin: " << test.origin
47 << ", Target: " << test.target
48 << ", Expectation: " << test.expectation);
49 GURL origin_url(test.origin);
50 GURL target_url(test.target);
51 EXPECT_EQ(test.expectation,
52 MixedContentNavigationThrottle::IsMixedContentForTesting(
53 origin_url, target_url));
54 }
55 }
56
57 } // content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698