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

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

Issue 545123002: Cleanup namespace usage in Source/web/. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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/SpinLockTest.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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 // Test restoring a HistoryItem properly restores the pinch viewport's state. 549 // Test restoring a HistoryItem properly restores the pinch viewport's state.
550 TEST_F(PinchViewportTest, TestRestoredFromHistoryItem) 550 TEST_F(PinchViewportTest, TestRestoredFromHistoryItem)
551 { 551 {
552 initializeWithDesktopSettings(); 552 initializeWithDesktopSettings();
553 webViewImpl()->resize(IntSize(200, 300)); 553 webViewImpl()->resize(IntSize(200, 300));
554 554
555 registerMockedHttpURLLoad("200-by-300.html"); 555 registerMockedHttpURLLoad("200-by-300.html");
556 556
557 WebHistoryItem item; 557 WebHistoryItem item;
558 item.initialize(); 558 item.initialize();
559 WebURL destinationURL(blink::URLTestHelpers::toKURL(m_baseURL + "200-by-300. html")); 559 WebURL destinationURL(URLTestHelpers::toKURL(m_baseURL + "200-by-300.html")) ;
560 item.setURLString(destinationURL.string()); 560 item.setURLString(destinationURL.string());
561 item.setPinchViewportScrollOffset(WebFloatPoint(100, 120)); 561 item.setPinchViewportScrollOffset(WebFloatPoint(100, 120));
562 item.setPageScaleFactor(2); 562 item.setPageScaleFactor(2);
563 563
564 FrameTestHelpers::loadHistoryItem(webViewImpl()->mainFrame(), item, WebHisto ryDifferentDocumentLoad, WebURLRequest::UseProtocolCachePolicy); 564 FrameTestHelpers::loadHistoryItem(webViewImpl()->mainFrame(), item, WebHisto ryDifferentDocumentLoad, WebURLRequest::UseProtocolCachePolicy);
565 565
566 PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport(); 566 PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport();
567 EXPECT_EQ(2, pinchViewport.scale()); 567 EXPECT_EQ(2, pinchViewport.scale());
568 568
569 EXPECT_FLOAT_POINT_EQ(FloatPoint(100, 120), pinchViewport.visibleRect().loca tion()); 569 EXPECT_FLOAT_POINT_EQ(FloatPoint(100, 120), pinchViewport.visibleRect().loca tion());
570 } 570 }
571 571
572 // Test restoring a HistoryItem without the pinch viewport offset falls back to distributing 572 // Test restoring a HistoryItem without the pinch viewport offset falls back to distributing
573 // the scroll offset between the main frame and the pinch viewport. 573 // the scroll offset between the main frame and the pinch viewport.
574 TEST_F(PinchViewportTest, TestRestoredFromLegacyHistoryItem) 574 TEST_F(PinchViewportTest, TestRestoredFromLegacyHistoryItem)
575 { 575 {
576 initializeWithDesktopSettings(); 576 initializeWithDesktopSettings();
577 webViewImpl()->resize(IntSize(100, 150)); 577 webViewImpl()->resize(IntSize(100, 150));
578 578
579 registerMockedHttpURLLoad("200-by-300-viewport.html"); 579 registerMockedHttpURLLoad("200-by-300-viewport.html");
580 580
581 WebHistoryItem item; 581 WebHistoryItem item;
582 item.initialize(); 582 item.initialize();
583 WebURL destinationURL(blink::URLTestHelpers::toKURL(m_baseURL + "200-by-300- viewport.html")); 583 WebURL destinationURL(URLTestHelpers::toKURL(m_baseURL + "200-by-300-viewpor t.html"));
584 item.setURLString(destinationURL.string()); 584 item.setURLString(destinationURL.string());
585 // (-1, -1) will be used if the HistoryItem is an older version prior to hav ing 585 // (-1, -1) will be used if the HistoryItem is an older version prior to hav ing
586 // pinch viewport scroll offset. 586 // pinch viewport scroll offset.
587 item.setPinchViewportScrollOffset(WebFloatPoint(-1, -1)); 587 item.setPinchViewportScrollOffset(WebFloatPoint(-1, -1));
588 item.setScrollOffset(WebPoint(120, 180)); 588 item.setScrollOffset(WebPoint(120, 180));
589 item.setPageScaleFactor(2); 589 item.setPageScaleFactor(2);
590 590
591 FrameTestHelpers::loadHistoryItem(webViewImpl()->mainFrame(), item, WebHisto ryDifferentDocumentLoad, WebURLRequest::UseProtocolCachePolicy); 591 FrameTestHelpers::loadHistoryItem(webViewImpl()->mainFrame(), item, WebHisto ryDifferentDocumentLoad, WebURLRequest::UseProtocolCachePolicy);
592 592
593 PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport(); 593 PinchViewport& pinchViewport = frame()->page()->frameHost().pinchViewport();
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 687
688 RenderObject* navbar = frame()->document()->getElementById("navbar")->render er(); 688 RenderObject* navbar = frame()->document()->getElementById("navbar")->render er();
689 689
690 EXPECT_FALSE(navbar->needsLayout()); 690 EXPECT_FALSE(navbar->needsLayout());
691 691
692 frame()->view()->resize(IntSize(500, 200)); 692 frame()->view()->resize(IntSize(500, 200));
693 693
694 EXPECT_TRUE(navbar->needsLayout()); 694 EXPECT_TRUE(navbar->needsLayout());
695 } 695 }
696 696
697 class MockWebFrameClient : public blink::WebFrameClient { 697 class MockWebFrameClient : public WebFrameClient {
698 public: 698 public:
699 MOCK_METHOD1(showContextMenu, void(const WebContextMenuData&)); 699 MOCK_METHOD1(showContextMenu, void(const WebContextMenuData&));
700 }; 700 };
701 701
702 MATCHER_P2(ContextMenuAtLocation, x, y, 702 MATCHER_P2(ContextMenuAtLocation, x, y,
703 std::string(negation ? "is" : "isn't") 703 std::string(negation ? "is" : "isn't")
704 + " at expected location [" 704 + " at expected location ["
705 + PrintToString(x) + ", " + PrintToString(y) + "]") 705 + PrintToString(x) + ", " + PrintToString(y) + "]")
706 { 706 {
707 return arg.mousePosition.x == x && arg.mousePosition.y == y; 707 return arg.mousePosition.x == x && arg.mousePosition.y == y;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 pinchViewport.scrollIntoView(FloatRect(50, 75, 50, 75)); 793 pinchViewport.scrollIntoView(FloatRect(50, 75, 50, 75));
794 EXPECT_POINT_EQ(IntPoint(50, 75), frame()->view()->scrollPosition()); 794 EXPECT_POINT_EQ(IntPoint(50, 75), frame()->view()->scrollPosition());
795 EXPECT_FLOAT_POINT_EQ(FloatPoint(), pinchViewport.visibleRect().location()); 795 EXPECT_FLOAT_POINT_EQ(FloatPoint(), pinchViewport.visibleRect().location());
796 796
797 pinchViewport.scrollIntoView(FloatRect(190, 290, 10, 10)); 797 pinchViewport.scrollIntoView(FloatRect(190, 290, 10, 10));
798 EXPECT_POINT_EQ(IntPoint(100, 150), frame()->view()->scrollPosition()); 798 EXPECT_POINT_EQ(IntPoint(100, 150), frame()->view()->scrollPosition());
799 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 75), pinchViewport.visibleRect().locati on()); 799 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 75), pinchViewport.visibleRect().locati on());
800 } 800 }
801 801
802 } // namespace 802 } // namespace
OLDNEW
« no previous file with comments | « Source/web/tests/MHTMLTest.cpp ('k') | Source/web/tests/SpinLockTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698