OLD | NEW |
---|---|
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 Loading... | |
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 // This is a hack to prevent createFrameView() from violating invariants | |
1551 // about frame state during navigation/detach. | |
1552 localFrame->frame()->document()->prepareForDestruction(); | |
dcheng
2015/04/03 14:35:45
I couldn't think of a good way to adapt this test
| |
1550 localFrame->createFrameView(); | 1553 localFrame->createFrameView(); |
1551 | 1554 |
1552 FrameView& frameView = *localFrame->frameView(); | 1555 FrameView& frameView = *localFrame->frameView(); |
1553 EXPECT_SIZE_EQ(IntSize(200, 400), frameView.frameRect().size()); | 1556 EXPECT_SIZE_EQ(IntSize(200, 400), frameView.frameRect().size()); |
1554 } | 1557 } |
1555 | 1558 |
1556 // Tests that the maximum scroll offset of the viewport can be fractional. | 1559 // Tests that the maximum scroll offset of the viewport can be fractional. |
1557 TEST_F(PinchViewportTest, FractionalMaxScrollOffset) | 1560 TEST_F(PinchViewportTest, FractionalMaxScrollOffset) |
1558 { | 1561 { |
1559 initializeWithDesktopSettings(); | 1562 initializeWithDesktopSettings(); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1666 EXPECT_FLOAT_POINT_EQ(FloatPoint(81, 100.8), pinchViewport.rootFrameToViewpo rt(FloatPoint(50.5, 62.4))); | 1669 EXPECT_FLOAT_POINT_EQ(FloatPoint(81, 100.8), pinchViewport.rootFrameToViewpo rt(FloatPoint(50.5, 62.4))); |
1667 | 1670 |
1668 | 1671 |
1669 // Scrolling the main frame should have no effect. | 1672 // Scrolling the main frame should have no effect. |
1670 frameView.scrollTo(DoublePoint(100, 120)); | 1673 frameView.scrollTo(DoublePoint(100, 120)); |
1671 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 62), pinchViewport.viewportToRootFrame( FloatPoint(80, 100))); | 1674 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))); | 1675 EXPECT_FLOAT_POINT_EQ(FloatPoint(80, 100), pinchViewport.rootFrameToViewport (FloatPoint(50, 62))); |
1673 } | 1676 } |
1674 | 1677 |
1675 } // namespace | 1678 } // namespace |
OLD | NEW |