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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 6
7 #include "core/frame/PinchViewport.h" 7 #include "core/frame/PinchViewport.h"
8 8
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/frame/FrameHost.h" 10 #include "core/frame/FrameHost.h"
(...skipping 15 matching lines...) Expand all
26 #include "public/web/WebFrameClient.h" 26 #include "public/web/WebFrameClient.h"
27 #include "public/web/WebInputEvent.h" 27 #include "public/web/WebInputEvent.h"
28 #include "public/web/WebScriptSource.h" 28 #include "public/web/WebScriptSource.h"
29 #include "public/web/WebSettings.h" 29 #include "public/web/WebSettings.h"
30 #include "public/web/WebViewClient.h" 30 #include "public/web/WebViewClient.h"
31 #include "web/WebLocalFrameImpl.h" 31 #include "web/WebLocalFrameImpl.h"
32 #include "web/tests/FrameTestHelpers.h" 32 #include "web/tests/FrameTestHelpers.h"
33 #include <gmock/gmock.h> 33 #include <gmock/gmock.h>
34 #include <gtest/gtest.h> 34 #include <gtest/gtest.h>
35 35
36 #include <string>
37
36 #define ASSERT_POINT_EQ(expected, actual) \ 38 #define ASSERT_POINT_EQ(expected, actual) \
37 do { \ 39 do { \
38 ASSERT_EQ((expected).x(), (actual).x()); \ 40 ASSERT_EQ((expected).x(), (actual).x()); \
39 ASSERT_EQ((expected).y(), (actual).y()); \ 41 ASSERT_EQ((expected).y(), (actual).y()); \
40 } while (false) 42 } while (false)
41 43
42 #define EXPECT_POINT_EQ(expected, actual) \ 44 #define EXPECT_POINT_EQ(expected, actual) \
43 do { \ 45 do { \
44 EXPECT_EQ((expected).x(), (actual).x()); \ 46 EXPECT_EQ((expected).x(), (actual).x()); \
45 EXPECT_EQ((expected).y(), (actual).y()); \ 47 EXPECT_EQ((expected).y(), (actual).y()); \
(...skipping 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after
1706 EXPECT_FLOAT_POINT_EQ(FloatPoint(50.5, 62.4), pinchViewport.viewportToRootFr ame(FloatPoint(81, 100.8))); 1708 EXPECT_FLOAT_POINT_EQ(FloatPoint(50.5, 62.4), pinchViewport.viewportToRootFr ame(FloatPoint(81, 100.8)));
1707 EXPECT_FLOAT_POINT_EQ(FloatPoint(81, 100.8), pinchViewport.rootFrameToViewpo rt(FloatPoint(50.5, 62.4))); 1709 EXPECT_FLOAT_POINT_EQ(FloatPoint(81, 100.8), pinchViewport.rootFrameToViewpo rt(FloatPoint(50.5, 62.4)));
1708 1710
1709 1711
1710 // Scrolling the main frame should have no effect. 1712 // Scrolling the main frame should have no effect.
1711 frameView.scrollTo(DoublePoint(100, 120)); 1713 frameView.scrollTo(DoublePoint(100, 120));
1712 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 62), pinchViewport.viewportToRootFrame( FloatPoint(80, 100))); 1714 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 62), pinchViewport.viewportToRootFrame( FloatPoint(80, 100)));
1713 EXPECT_FLOAT_POINT_EQ(FloatPoint(80, 100), pinchViewport.rootFrameToViewport (FloatPoint(50, 62))); 1715 EXPECT_FLOAT_POINT_EQ(FloatPoint(80, 100), pinchViewport.rootFrameToViewport (FloatPoint(50, 62)));
1714 } 1716 }
1715 1717
1718 // Tests that the window dimensions are available before a full layout occurs.
1719 // More specifically, it checks that the innerWidth and innerHeight window
1720 // properties, which depend on page scale, reflect the initial scale that the
1721 // 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.
1722 TEST_F(PinchViewportTest, WindowDimensionsOnLoad)
1723 {
1724 initializeWithAndroidSettings();
1725 registerMockedHttpURLLoad("window_dimensions.html");
1726 webViewImpl()->resize(IntSize(800, 600));
1727 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.
1728
1729 Element* output = frame()->document()->getElementById("output");
1730 ASSERT(output);
1731 EXPECT_EQ(std::string("1600x1200"), std::string(output->innerHTML().ascii(). data()));
1732 }
1733
1716 } // namespace 1734 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698