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

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

Issue 2043753002: Declarative resource hints go through mojo IPC to //content Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use unique_ptr to avoid memory leaks in unit tests 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/HTMLPreloadScanner.h" 5 #include "core/html/parser/HTMLPreloadScanner.h"
6 6
7 #include "core/MediaTypeNames.h" 7 #include "core/MediaTypeNames.h"
8 #include "core/css/MediaValuesCached.h" 8 #include "core/css/MediaValuesCached.h"
9 #include "core/fetch/ClientHintsPreferences.h" 9 #include "core/fetch/ClientHintsPreferences.h"
10 #include "core/frame/Settings.h" 10 #include "core/frame/Settings.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 void preconnectRequestVerification(const String& host, CrossOriginAttributeV alue crossOrigin) 73 void preconnectRequestVerification(const String& host, CrossOriginAttributeV alue crossOrigin)
74 { 74 {
75 if (!host.isNull()) { 75 if (!host.isNull()) {
76 EXPECT_TRUE(m_preloadRequest->isPreconnect()); 76 EXPECT_TRUE(m_preloadRequest->isPreconnect());
77 EXPECT_STREQ(m_preloadRequest->resourceURL().ascii().data(), host.as cii().data()); 77 EXPECT_STREQ(m_preloadRequest->resourceURL().ascii().data(), host.as cii().data());
78 EXPECT_EQ(m_preloadRequest->crossOrigin(), crossOrigin); 78 EXPECT_EQ(m_preloadRequest->crossOrigin(), crossOrigin);
79 } 79 }
80 } 80 }
81 81
82 protected: 82 protected:
83 void preload(PassOwnPtr<PreloadRequest> preloadRequest, const NetworkHintsIn terface&) override 83 void preload(PassOwnPtr<PreloadRequest> preloadRequest) override
84 { 84 {
85 m_preloadRequest = std::move(preloadRequest); 85 m_preloadRequest = std::move(preloadRequest);
86 } 86 }
87 87
88 private: 88 private:
89 OwnPtr<PreloadRequest> m_preloadRequest; 89 OwnPtr<PreloadRequest> m_preloadRequest;
90 }; 90 };
91 91
92 class HTMLPreloadScannerTest : public testing::Test { 92 class HTMLPreloadScannerTest : public testing::Test {
93 protected: 93 protected:
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 {"http://example.test", "<link rel=preload href=bla as=track>", "bla", " http://example.test/", Resource::TextTrack, 0}, 407 {"http://example.test", "<link rel=preload href=bla as=track>", "bla", " http://example.test/", Resource::TextTrack, 0},
408 {"http://example.test", "<link rel=preload href=bla as=image media=\"(ma x-width: 800px)\">", "bla", "http://example.test/", Resource::Image, 0}, 408 {"http://example.test", "<link rel=preload href=bla as=image media=\"(ma x-width: 800px)\">", "bla", "http://example.test/", Resource::Image, 0},
409 {"http://example.test", "<link rel=preload href=bla as=image media=\"(ma x-width: 400px)\">", nullptr, "http://example.test/", Resource::Image, 0}, 409 {"http://example.test", "<link rel=preload href=bla as=image media=\"(ma x-width: 400px)\">", nullptr, "http://example.test/", Resource::Image, 0},
410 }; 410 };
411 411
412 for (const auto& testCase : testCases) 412 for (const auto& testCase : testCases)
413 test(testCase); 413 test(testCase);
414 } 414 }
415 415
416 } // namespace blink 416 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698