OLD | NEW |
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 EXPECT_STREQ(baseURL, m_preloadRequest->baseURL().string().ascii().data(
)); | 58 EXPECT_STREQ(baseURL, m_preloadRequest->baseURL().string().ascii().data(
)); |
59 EXPECT_EQ(width, m_preloadRequest->resourceWidth()); | 59 EXPECT_EQ(width, m_preloadRequest->resourceWidth()); |
60 EXPECT_EQ(preferences.shouldSendDPR(), m_preloadRequest->preferences().s
houldSendDPR()); | 60 EXPECT_EQ(preferences.shouldSendDPR(), m_preloadRequest->preferences().s
houldSendDPR()); |
61 EXPECT_EQ(preferences.shouldSendResourceWidth(), m_preloadRequest->prefe
rences().shouldSendResourceWidth()); | 61 EXPECT_EQ(preferences.shouldSendResourceWidth(), m_preloadRequest->prefe
rences().shouldSendResourceWidth()); |
62 EXPECT_EQ(preferences.shouldSendViewportWidth(), m_preloadRequest->prefe
rences().shouldSendViewportWidth()); | 62 EXPECT_EQ(preferences.shouldSendViewportWidth(), m_preloadRequest->prefe
rences().shouldSendViewportWidth()); |
63 } | 63 } |
64 | 64 |
65 void preloadRequestVerification(Resource::Type type, const char* url, const
char* baseURL, int width, ReferrerPolicy referrerPolicy) | 65 void preloadRequestVerification(Resource::Type type, const char* url, const
char* baseURL, int width, ReferrerPolicy referrerPolicy) |
66 { | 66 { |
67 preloadRequestVerification(type, url, baseURL, width, ClientHintsPrefere
nces()); | 67 preloadRequestVerification(type, url, baseURL, width, ClientHintsPrefere
nces()); |
68 EXPECT_EQ(referrerPolicy, m_preloadRequest->referrerPolicy()); | 68 EXPECT_EQ(referrerPolicy, m_preloadRequest->getReferrerPolicy()); |
69 } | 69 } |
70 | 70 |
71 void preconnectRequestVerification(const String& host, CrossOriginAttributeV
alue crossOrigin) | 71 void preconnectRequestVerification(const String& host, CrossOriginAttributeV
alue crossOrigin) |
72 { | 72 { |
73 if (!host.isNull()) { | 73 if (!host.isNull()) { |
74 EXPECT_TRUE(m_preloadRequest->isPreconnect()); | 74 EXPECT_TRUE(m_preloadRequest->isPreconnect()); |
75 EXPECT_STREQ(m_preloadRequest->resourceURL().ascii().data(), host.as
cii().data()); | 75 EXPECT_STREQ(m_preloadRequest->resourceURL().ascii().data(), host.as
cii().data()); |
76 EXPECT_EQ(m_preloadRequest->crossOrigin(), crossOrigin); | 76 EXPECT_EQ(m_preloadRequest->crossOrigin(), crossOrigin); |
77 } | 77 } |
78 } | 78 } |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 {"http://example.test", "<link rel=preload href=bla as=audio>", "bla", "
http://example.test/", Resource::Media, 0}, | 373 {"http://example.test", "<link rel=preload href=bla as=audio>", "bla", "
http://example.test/", Resource::Media, 0}, |
374 {"http://example.test", "<link rel=preload href=bla as=video>", "bla", "
http://example.test/", Resource::Media, 0}, | 374 {"http://example.test", "<link rel=preload href=bla as=video>", "bla", "
http://example.test/", Resource::Media, 0}, |
375 {"http://example.test", "<link rel=preload href=bla as=track>", "bla", "
http://example.test/", Resource::TextTrack, 0}, | 375 {"http://example.test", "<link rel=preload href=bla as=track>", "bla", "
http://example.test/", Resource::TextTrack, 0}, |
376 }; | 376 }; |
377 | 377 |
378 for (const auto& testCase : testCases) | 378 for (const auto& testCase : testCases) |
379 test(testCase); | 379 test(testCase); |
380 } | 380 } |
381 | 381 |
382 } // namespace blink | 382 } // namespace blink |
OLD | NEW |