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

Unified Diff: Source/core/loader/FrameFetchContextTest.cpp

Issue 1183233002: Split RW hint into Width and Viewport-Width (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed and added layout tests Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/loader/FrameFetchContext.cpp ('k') | Source/core/loader/ImageLoader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/FrameFetchContextTest.cpp
diff --git a/Source/core/loader/FrameFetchContextTest.cpp b/Source/core/loader/FrameFetchContextTest.cpp
index 208dce209fb684b7293ea7338fa4ab6572c44c84..d18df401db0925b019fbfc8cba363ac263c5025c 100644
--- a/Source/core/loader/FrameFetchContextTest.cpp
+++ b/Source/core/loader/FrameFetchContextTest.cpp
@@ -263,34 +263,49 @@ TEST_F(FrameFetchContextHintsTest, MonitorDPRHints)
expectHeader("http://www.example.com/1.gif", "DPR", true, "1");
dummyPageHolder->page().setDeviceScaleFactor(2.5);
expectHeader("http://www.example.com/1.gif", "DPR", true, "2.5");
- expectHeader("http://www.example.com/1.gif", "RW", false, "");
+ expectHeader("http://www.example.com/1.gif", "Width", false, "");
+ expectHeader("http://www.example.com/1.gif", "Viewport-Width", false, "");
}
-TEST_F(FrameFetchContextHintsTest, MonitorRWHints)
+TEST_F(FrameFetchContextHintsTest, MonitorResourceWidthHints)
{
- expectHeader("http://www.example.com/1.gif", "RW", false, "");
+ expectHeader("http://www.example.com/1.gif", "Width", false, "");
ClientHintsPreferences preferences;
- preferences.setShouldSendRW(true);
+ preferences.setShouldSendResourceWidth(true);
document->setClientHintsPreferences(preferences);
- expectHeader("http://www.example.com/1.gif", "RW", true, "500");
+ expectHeader("http://www.example.com/1.gif", "Width", true, "500", 500);
+ expectHeader("http://www.example.com/1.gif", "Width", true, "667", 666.6666);
+ expectHeader("http://www.example.com/1.gif", "DPR", false, "");
+}
+
+TEST_F(FrameFetchContextHintsTest, MonitorViewportWidthHints)
+{
+ expectHeader("http://www.example.com/1.gif", "Viewport-Width", false, "");
+ ClientHintsPreferences preferences;
+ preferences.setShouldSendViewportWidth(true);
+ document->setClientHintsPreferences(preferences);
+ expectHeader("http://www.example.com/1.gif", "Viewport-Width", true, "500");
dummyPageHolder->frameView().setLayoutSizeFixedToFrameSize(false);
dummyPageHolder->frameView().setLayoutSize(IntSize(800, 800));
- expectHeader("http://www.example.com/1.gif", "RW", true, "800");
- expectHeader("http://www.example.com/1.gif", "RW", true, "667", 666.6666);
+ expectHeader("http://www.example.com/1.gif", "Viewport-Width", true, "800");
+ expectHeader("http://www.example.com/1.gif", "Viewport-Width", true, "800", 666.6666);
expectHeader("http://www.example.com/1.gif", "DPR", false, "");
}
-TEST_F(FrameFetchContextHintsTest, MonitorBothHints)
+TEST_F(FrameFetchContextHintsTest, MonitorAllHints)
{
expectHeader("http://www.example.com/1.gif", "DPR", false, "");
- expectHeader("http://www.example.com/1.gif", "RW", false, "");
+ expectHeader("http://www.example.com/1.gif", "Viewport-Width", false, "");
+ expectHeader("http://www.example.com/1.gif", "Width", false, "");
ClientHintsPreferences preferences;
preferences.setShouldSendDPR(true);
- preferences.setShouldSendRW(true);
+ preferences.setShouldSendResourceWidth(true);
+ preferences.setShouldSendViewportWidth(true);
document->setClientHintsPreferences(preferences);
expectHeader("http://www.example.com/1.gif", "DPR", true, "1");
- expectHeader("http://www.example.com/1.gif", "RW", true, "500");
+ expectHeader("http://www.example.com/1.gif", "Width", true, "400", 400);
+ expectHeader("http://www.example.com/1.gif", "Viewport-Width", true, "500");
}
} // namespace
« no previous file with comments | « Source/core/loader/FrameFetchContext.cpp ('k') | Source/core/loader/ImageLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698