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

Side by Side Diff: Source/web/tests/PinchViewportTest.cpp

Issue 1052993006: Refactor frame navigation/detach state cleanup to be more sane. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Minor test cleanup 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/tests/FrameTestHelpers.cpp ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 TEST_F(PinchViewportTest, TestMainFrameInitializationSizing) 1540 TEST_F(PinchViewportTest, TestMainFrameInitializationSizing)
1541 { 1541 {
1542 initializeWithAndroidSettings(); 1542 initializeWithAndroidSettings();
1543 1543
1544 webViewImpl()->resize(IntSize(100, 200)); 1544 webViewImpl()->resize(IntSize(100, 200));
1545 1545
1546 registerMockedHttpURLLoad("content-width-1000-min-scale.html"); 1546 registerMockedHttpURLLoad("content-width-1000-min-scale.html");
1547 navigateTo(m_baseURL + "content-width-1000-min-scale.html"); 1547 navigateTo(m_baseURL + "content-width-1000-min-scale.html");
1548 1548
1549 WebLocalFrameImpl* localFrame = webViewImpl()->mainFrameImpl(); 1549 WebLocalFrameImpl* localFrame = webViewImpl()->mainFrameImpl();
1550 // The prepareForDestruction() and prepareForDetach() calls are a hack to
1551 // prevent createView() from violating invariants about frame state during
1552 // navigation/detach.
1553 localFrame->frame()->document()->prepareForDestruction();
1550 localFrame->createFrameView(); 1554 localFrame->createFrameView();
1551 1555
1552 FrameView& frameView = *localFrame->frameView(); 1556 FrameView& frameView = *localFrame->frameView();
1553 EXPECT_SIZE_EQ(IntSize(200, 400), frameView.frameRect().size()); 1557 EXPECT_SIZE_EQ(IntSize(200, 400), frameView.frameRect().size());
1558 frameView.prepareForDetach();
1554 } 1559 }
1555 1560
1556 // Tests that the maximum scroll offset of the viewport can be fractional. 1561 // Tests that the maximum scroll offset of the viewport can be fractional.
1557 TEST_F(PinchViewportTest, FractionalMaxScrollOffset) 1562 TEST_F(PinchViewportTest, FractionalMaxScrollOffset)
1558 { 1563 {
1559 initializeWithDesktopSettings(); 1564 initializeWithDesktopSettings();
1560 webViewImpl()->resize(IntSize(101, 201)); 1565 webViewImpl()->resize(IntSize(101, 201));
1561 navigateTo("about:blank"); 1566 navigateTo("about:blank");
1562 1567
1563 PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport(); 1568 PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport();
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 EXPECT_FLOAT_POINT_EQ(FloatPoint(81, 100.8), pinchViewport.rootFrameToViewpo rt(FloatPoint(50.5, 62.4))); 1671 EXPECT_FLOAT_POINT_EQ(FloatPoint(81, 100.8), pinchViewport.rootFrameToViewpo rt(FloatPoint(50.5, 62.4)));
1667 1672
1668 1673
1669 // Scrolling the main frame should have no effect. 1674 // Scrolling the main frame should have no effect.
1670 frameView.scrollTo(DoublePoint(100, 120)); 1675 frameView.scrollTo(DoublePoint(100, 120));
1671 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 62), pinchViewport.viewportToRootFrame( FloatPoint(80, 100))); 1676 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 62), pinchViewport.viewportToRootFrame( FloatPoint(80, 100)));
1672 EXPECT_FLOAT_POINT_EQ(FloatPoint(80, 100), pinchViewport.rootFrameToViewport (FloatPoint(50, 62))); 1677 EXPECT_FLOAT_POINT_EQ(FloatPoint(80, 100), pinchViewport.rootFrameToViewport (FloatPoint(50, 62)));
1673 } 1678 }
1674 1679
1675 } // namespace 1680 } // namespace
OLDNEW
« no previous file with comments | « Source/web/tests/FrameTestHelpers.cpp ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698