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

Unified Diff: Source/web/tests/PinchViewportTest.cpp

Issue 1094673002: Make window.innerWidth and innerHeight cause layout if needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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
Index: Source/web/tests/PinchViewportTest.cpp
diff --git a/Source/web/tests/PinchViewportTest.cpp b/Source/web/tests/PinchViewportTest.cpp
index 686a14ba55612286909574e97d8f3f11808e385c..4abb6013521434bc92540a69213d6e9276037ba5 100644
--- a/Source/web/tests/PinchViewportTest.cpp
+++ b/Source/web/tests/PinchViewportTest.cpp
@@ -33,6 +33,8 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
+#include <string>
+
#define ASSERT_POINT_EQ(expected, actual) \
do { \
ASSERT_EQ((expected).x(), (actual).x()); \
@@ -1713,4 +1715,20 @@ TEST_F(PinchViewportTest, TestCoordinateTransforms)
EXPECT_FLOAT_POINT_EQ(FloatPoint(80, 100), pinchViewport.rootFrameToViewport(FloatPoint(50, 62)));
}
+// Tests that the window dimensions are available before a full layout occurs.
+// More specifically, it checks that the innerWidth and innerHeight window
+// properties, which depend on page scale, reflect the initial scale that the
+// page will load with.
rune 2015/04/16 22:02:12 We really tests that the innerWidth/innerHeight ma
bokan 2015/04/20 17:47:24 Done.
+TEST_F(PinchViewportTest, WindowDimensionsOnLoad)
+{
+ initializeWithAndroidSettings();
+ registerMockedHttpURLLoad("window_dimensions.html");
+ webViewImpl()->resize(IntSize(800, 600));
+ navigateTo(m_baseURL + "window_dimensions.html");
rune 2015/04/16 22:02:12 Could you also add a test where the contents overf
bokan 2015/04/20 17:47:24 Done.
+
+ Element* output = frame()->document()->getElementById("output");
+ ASSERT(output);
+ EXPECT_EQ(std::string("1600x1200"), std::string(output->innerHTML().ascii().data()));
+}
+
} // namespace

Powered by Google App Engine
This is Rietveld 408576698