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

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: Minor changes from nasko@'s comments Created 3 years, 10 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 "content/browser/frame_host/mixed_content_navigation_throttle.h"
6
7 #include "base/macros.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace content {
11
12 // Tests that MixedContentNavigationThrottle correctly detects or ignores many
13 // cases where there is or there is not mixed content, respectively.
14 // Note: Browser side version of MixedContentCheckerTest.IsMixedContent. Must be
15 // kept in sync manually!
16 TEST(MixedContentNavigationThrottleTest, IsMixedContent) {
17 struct TestCase {
18 const char* origin;
19 const char* target;
20 const bool expected_mixed_content;
21 } cases[] = {
22 {"http://example.com/foo", "http://example.com/foo", false},
23 {"http://example.com/foo", "https://example.com/foo", false},
24 {"http://example.com/foo", "data:text/html,<p>Hi!</p>", false},
25 {"http://example.com/foo", "about:blank", false},
26 {"https://example.com/foo", "https://example.com/foo", false},
27 {"https://example.com/foo", "wss://example.com/foo", false},
28 {"https://example.com/foo", "data:text/html,<p>Hi!</p>", false},
29 {"https://example.com/foo", "http://127.0.0.1/", false},
30 {"https://example.com/foo", "http://[::1]/", false},
31 {"https://example.com/foo", "blob:https://example.com/foo", false},
32 {"https://example.com/foo", "blob:http://example.com/foo", false},
33 {"https://example.com/foo", "blob:null/foo", false},
34 {"https://example.com/foo", "filesystem:https://example.com/foo", false},
35 {"https://example.com/foo", "filesystem:http://example.com/foo", false},
36 {"https://example.com/foo", "filesystem:null/foo", false},
37
38 {"https://example.com/foo", "http://example.com/foo", true},
39 {"https://example.com/foo", "http://google.com/foo", true},
40 {"https://example.com/foo", "ws://example.com/foo", true},
41 {"https://example.com/foo", "ws://google.com/foo", true},
42 {"https://example.com/foo", "http://192.168.1.1/", true},
43 {"https://example.com/foo", "http://localhost/", true},
44 };
45
46 for (const auto& test : cases) {
47 SCOPED_TRACE(::testing::Message()
48 << "Origin: " << test.origin << ", Target: " << test.target
49 << ", Expectation: " << test.expected_mixed_content);
50 GURL origin_url(test.origin);
51 GURL target_url(test.target);
52 EXPECT_EQ(test.expected_mixed_content,
53 MixedContentNavigationThrottle::IsMixedContentForTesting(
54 origin_url, target_url));
55 }
56 }
57
58 } // content
OLDNEW
« no previous file with comments | « content/browser/frame_host/mixed_content_navigation_throttle.cc ('k') | content/browser/frame_host/navigation_handle_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698