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

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

Issue 336553003: Change Page::m_mainFrame to be a Frame. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/web/tests/MHTMLTest.cpp ('k') | Source/web/tests/ViewportTest.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/frame/FrameHost.h" 9 #include "core/frame/FrameHost.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 TEST_F(PinchViewportTest, TestSavedToHistoryItem) 528 TEST_F(PinchViewportTest, TestSavedToHistoryItem)
529 { 529 {
530 initializeWithDesktopSettings(); 530 initializeWithDesktopSettings();
531 webViewImpl()->resize(IntSize(200, 300)); 531 webViewImpl()->resize(IntSize(200, 300));
532 webViewImpl()->layout(); 532 webViewImpl()->layout();
533 533
534 registerMockedHttpURLLoad("200-by-300.html"); 534 registerMockedHttpURLLoad("200-by-300.html");
535 navigateTo(m_baseURL + "200-by-300.html"); 535 navigateTo(m_baseURL + "200-by-300.html");
536 536
537 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), 537 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0),
538 webViewImpl()->page()->mainFrame()->loader().currentItem()->pinchViewpor tScrollPoint()); 538 toLocalFrame(webViewImpl()->page()->mainFrame())->loader().currentItem() ->pinchViewportScrollPoint());
539 539
540 PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport(); 540 PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport();
541 pinchViewport.setScale(2); 541 pinchViewport.setScale(2);
542 542
543 EXPECT_EQ(2, webViewImpl()->page()->mainFrame()->loader().currentItem()->pag eScaleFactor()); 543 EXPECT_EQ(2, toLocalFrame(webViewImpl()->page()->mainFrame())->loader().curr entItem()->pageScaleFactor());
544 544
545 pinchViewport.setLocation(FloatPoint(10, 20)); 545 pinchViewport.setLocation(FloatPoint(10, 20));
546 546
547 EXPECT_FLOAT_POINT_EQ(FloatPoint(10, 20), 547 EXPECT_FLOAT_POINT_EQ(FloatPoint(10, 20),
548 webViewImpl()->page()->mainFrame()->loader().currentItem()->pinchViewpor tScrollPoint()); 548 toLocalFrame(webViewImpl()->page()->mainFrame())->loader().currentItem() ->pinchViewportScrollPoint());
549 } 549 }
550 550
551 // Test restoring a HistoryItem properly restores the pinch viewport's state. 551 // Test restoring a HistoryItem properly restores the pinch viewport's state.
552 TEST_F(PinchViewportTest, TestRestoredFromHistoryItem) 552 TEST_F(PinchViewportTest, TestRestoredFromHistoryItem)
553 { 553 {
554 initializeWithDesktopSettings(); 554 initializeWithDesktopSettings();
555 webViewImpl()->resize(IntSize(200, 300)); 555 webViewImpl()->resize(IntSize(200, 300));
556 556
557 registerMockedHttpURLLoad("200-by-300.html"); 557 registerMockedHttpURLLoad("200-by-300.html");
558 558
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 pinchViewport.scrollIntoView(FloatRect(50, 75, 50, 75)); 795 pinchViewport.scrollIntoView(FloatRect(50, 75, 50, 75));
796 EXPECT_POINT_EQ(IntPoint(50, 75), frame()->view()->scrollPosition()); 796 EXPECT_POINT_EQ(IntPoint(50, 75), frame()->view()->scrollPosition());
797 EXPECT_FLOAT_POINT_EQ(FloatPoint(), pinchViewport.visibleRect().location()); 797 EXPECT_FLOAT_POINT_EQ(FloatPoint(), pinchViewport.visibleRect().location());
798 798
799 pinchViewport.scrollIntoView(FloatRect(190, 290, 10, 10)); 799 pinchViewport.scrollIntoView(FloatRect(190, 290, 10, 10));
800 EXPECT_POINT_EQ(IntPoint(100, 150), frame()->view()->scrollPosition()); 800 EXPECT_POINT_EQ(IntPoint(100, 150), frame()->view()->scrollPosition());
801 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 75), pinchViewport.visibleRect().locati on()); 801 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 75), pinchViewport.visibleRect().locati on());
802 } 802 }
803 803
804 } // namespace 804 } // namespace
OLDNEW
« no previous file with comments | « Source/web/tests/MHTMLTest.cpp ('k') | Source/web/tests/ViewportTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698