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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLResourcePreloaderTest.cpp

Issue 2043753002: Declarative resource hints go through mojo IPC to //content Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "core/html/parser/HTMLResourcePreloader.h" 5 #include "core/html/parser/HTMLResourcePreloader.h"
6 6
7 #include "core/html/parser/PreloadRequest.h" 7 #include "core/html/parser/PreloadRequest.h"
8 #include "core/testing/DummyPageHolder.h" 8 #include "core/testing/DummyPageHolder.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 struct PreconnectTestCase { 13 struct PreconnectTestCase {
14 const char* baseURL; 14 const char* baseURL;
15 const char* url; 15 const char* url;
16 bool isCORS; 16 bool isCORS;
17 bool isHTTPS; 17 bool isHTTPS;
18 }; 18 };
19 19
20 class PreloaderNetworkHintsMock : public NetworkHintsInterface { 20 class PreloaderNetworkHintsMock : public NetworkHintsInterface {
21 public: 21 public:
22 PreloaderNetworkHintsMock() 22 PreloaderNetworkHintsMock()
23 : m_didPreconnect(false) 23 : m_didPreconnect(false)
24 { 24 {
25 } 25 }
26 26
27 void dnsPrefetchHost(const String& host) const { } 27 void dnsPrefetchHost(const KURL& host) const { }
28 void preconnectHost(const KURL& host, const CrossOriginAttributeValue crossO rigin) const override 28 void preconnectHost(const KURL& host, const CrossOriginAttributeValue crossO rigin) const override
29 { 29 {
30 m_didPreconnect = true; 30 m_didPreconnect = true;
31 m_isHTTPS = host.protocolIs("https"); 31 m_isHTTPS = host.protocolIs("https");
32 m_isCrossOrigin = (crossOrigin == CrossOriginAttributeAnonymous); 32 m_isCrossOrigin = (crossOrigin == CrossOriginAttributeAnonymous);
33 } 33 }
34 34
35 bool didPreconnect() { return m_didPreconnect; } 35 bool didPreconnect() { return m_didPreconnect; }
36 bool isHTTPS() { return m_isHTTPS; } 36 bool isHTTPS() { return m_isHTTPS; }
37 bool isCrossOrigin() { return m_isCrossOrigin; } 37 bool isCrossOrigin() { return m_isCrossOrigin; }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 { "http://example.test", "//example.com", true, false }, 86 { "http://example.test", "//example.com", true, false },
87 { "https://example.test", "//example.com", false, true }, 87 { "https://example.test", "//example.com", false, true },
88 { "https://example.test", "//example.com", true, true }, 88 { "https://example.test", "//example.com", true, true },
89 }; 89 };
90 90
91 for (const auto& testCase : testCases) 91 for (const auto& testCase : testCases)
92 test(testCase); 92 test(testCase);
93 } 93 }
94 94
95 } // namespace blink 95 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698