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

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

Issue 1982263002: Fix preloadScanner double download issue with link preload and media (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comment Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp
index a026cf23ee7ff9aa2d6a2775a52acf67c931eb35..26fb368b6a8479b779b9180db233c4076b300a6e 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp
@@ -51,15 +51,17 @@ public:
EXPECT_FALSE(m_preloadRequest);
return;
}
- ASSERT(m_preloadRequest.get());
- EXPECT_FALSE(m_preloadRequest->isPreconnect());
- EXPECT_EQ(type, m_preloadRequest->resourceType());
- EXPECT_STREQ(url, m_preloadRequest->resourceURL().ascii().data());
- EXPECT_STREQ(baseURL, m_preloadRequest->baseURL().getString().ascii().data());
- EXPECT_EQ(width, m_preloadRequest->resourceWidth());
- EXPECT_EQ(preferences.shouldSendDPR(), m_preloadRequest->preferences().shouldSendDPR());
- EXPECT_EQ(preferences.shouldSendResourceWidth(), m_preloadRequest->preferences().shouldSendResourceWidth());
- EXPECT_EQ(preferences.shouldSendViewportWidth(), m_preloadRequest->preferences().shouldSendViewportWidth());
+ EXPECT_NE(nullptr, m_preloadRequest.get());
+ if (m_preloadRequest) {
+ EXPECT_FALSE(m_preloadRequest->isPreconnect());
+ EXPECT_EQ(type, m_preloadRequest->resourceType());
+ EXPECT_STREQ(url, m_preloadRequest->resourceURL().ascii().data());
+ EXPECT_STREQ(baseURL, m_preloadRequest->baseURL().getString().ascii().data());
+ EXPECT_EQ(width, m_preloadRequest->resourceWidth());
+ EXPECT_EQ(preferences.shouldSendDPR(), m_preloadRequest->preferences().shouldSendDPR());
+ EXPECT_EQ(preferences.shouldSendResourceWidth(), m_preloadRequest->preferences().shouldSendResourceWidth());
+ EXPECT_EQ(preferences.shouldSendViewportWidth(), m_preloadRequest->preferences().shouldSendViewportWidth());
+ }
}
void preloadRequestVerification(Resource::Type type, const char* url, const char* baseURL, int width, ReferrerPolicy referrerPolicy)
@@ -395,6 +397,8 @@ TEST_F(HTMLPreloadScannerTest, testLinkRelPreload)
{"http://example.test", "<link rel=preload href=bla as=font>", "bla", "http://example.test/", Resource::Font, 0},
{"http://example.test", "<link rel=preload href=bla as=media>", "bla", "http://example.test/", Resource::Media, 0},
{"http://example.test", "<link rel=preload href=bla as=track>", "bla", "http://example.test/", Resource::TextTrack, 0},
+ {"http://example.test", "<link rel=preload href=bla as=image media=\"(max-width: 800px)\">", "bla", "http://example.test/", Resource::Image, 0},
+ {"http://example.test", "<link rel=preload href=bla as=image media=\"(max-width: 400px)\">", nullptr, "http://example.test/", Resource::Image, 0},
};
for (const auto& testCase : testCases)
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698