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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp

Issue 2237433004: Adds DevTools commands for forced viewport override. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adress Dmitry's comments + sync. Created 4 years, 2 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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 25 matching lines...) Expand all
36 #include "core/events/KeyboardEvent.h" 36 #include "core/events/KeyboardEvent.h"
37 #include "core/events/MouseEvent.h" 37 #include "core/events/MouseEvent.h"
38 #include "core/events/TouchEvent.h" 38 #include "core/events/TouchEvent.h"
39 #include "core/events/WheelEvent.h" 39 #include "core/events/WheelEvent.h"
40 #include "core/frame/FrameHost.h" 40 #include "core/frame/FrameHost.h"
41 #include "core/frame/FrameView.h" 41 #include "core/frame/FrameView.h"
42 #include "core/frame/LocalFrame.h" 42 #include "core/frame/LocalFrame.h"
43 #include "core/frame/VisualViewport.h" 43 #include "core/frame/VisualViewport.h"
44 #include "core/layout/api/LayoutViewItem.h" 44 #include "core/layout/api/LayoutViewItem.h"
45 #include "core/page/Page.h" 45 #include "core/page/Page.h"
46 #include "platform/geometry/IntSize.h"
46 #include "platform/testing/URLTestHelpers.h" 47 #include "platform/testing/URLTestHelpers.h"
47 #include "public/web/WebFrame.h" 48 #include "public/web/WebFrame.h"
48 #include "public/web/WebSettings.h" 49 #include "public/web/WebSettings.h"
49 #include "testing/gtest/include/gtest/gtest.h" 50 #include "testing/gtest/include/gtest/gtest.h"
51 #include "web/WebLocalFrameImpl.h"
50 #include "web/WebViewImpl.h" 52 #include "web/WebViewImpl.h"
51 #include "web/tests/FrameTestHelpers.h" 53 #include "web/tests/FrameTestHelpers.h"
52 54
53 namespace blink { 55 namespace blink {
54 56
55 KeyboardEvent* createKeyboardEventWithLocation(KeyboardEvent::KeyLocationCode lo cation) 57 KeyboardEvent* createKeyboardEventWithLocation(KeyboardEvent::KeyLocationCode lo cation)
56 { 58 {
57 return KeyboardEvent::create("keydown", true, true, 0, "", "", location, Pla tformEvent::NoModifiers, 0); 59 return KeyboardEvent::create("keydown", true, true, 0, "", "", location, Pla tformEvent::NoModifiers, 0);
58 } 60 }
59 61
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html")); 507 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html"));
506 FrameTestHelpers::WebViewHelper webViewHelper; 508 FrameTestHelpers::WebViewHelper webViewHelper;
507 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true); 509 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true);
508 webViewImpl->settings()->setViewportEnabled(true); 510 webViewImpl->settings()->setViewportEnabled(true);
509 int pageWidth = 640; 511 int pageWidth = 640;
510 int pageHeight = 480; 512 int pageHeight = 480;
511 webViewImpl->resize(WebSize(pageWidth, pageHeight)); 513 webViewImpl->resize(WebSize(pageWidth, pageHeight));
512 webViewImpl->updateAllLifecyclePhases(); 514 webViewImpl->updateAllLifecyclePhases();
513 515
514 webViewImpl->setPageScaleFactor(2); 516 webViewImpl->setPageScaleFactor(2);
515 webViewImpl->setRootLayerTransform(WebSize(10, 20), 1.5); 517 webViewImpl->mainFrameImpl()->setInputEventsTransformForEmulation(IntSize(10 , 20), 1.5);
516 518
517 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); 519 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view();
518 520
519 { 521 {
520 WebMouseEvent webMouseEvent; 522 WebMouseEvent webMouseEvent;
521 webMouseEvent.type = WebInputEvent::MouseMove; 523 webMouseEvent.type = WebInputEvent::MouseMove;
522 webMouseEvent.x = 100; 524 webMouseEvent.x = 100;
523 webMouseEvent.y = 110; 525 webMouseEvent.y = 110;
524 webMouseEvent.windowX = 100; 526 webMouseEvent.windowX = 100;
525 webMouseEvent.windowY = 110; 527 webMouseEvent.windowY = 110;
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x()); 1114 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x());
1113 EXPECT_EQ(15, platformGestureBuilder.globalPosition().y()); 1115 EXPECT_EQ(15, platformGestureBuilder.globalPosition().y());
1114 EXPECT_EQ(ScrollInertialPhaseNonMomentum, platformGestureBuilder.inertia lPhase()); 1116 EXPECT_EQ(ScrollInertialPhaseNonMomentum, platformGestureBuilder.inertia lPhase());
1115 EXPECT_TRUE(platformGestureBuilder.synthetic()); 1117 EXPECT_TRUE(platformGestureBuilder.synthetic());
1116 EXPECT_EQ(ScrollGranularity::ScrollByPage, platformGestureBuilder.deltaU nits()); 1118 EXPECT_EQ(ScrollGranularity::ScrollByPage, platformGestureBuilder.deltaU nits());
1117 EXPECT_EQ(12345U, platformGestureBuilder.uniqueTouchEventId()); 1119 EXPECT_EQ(12345U, platformGestureBuilder.uniqueTouchEventId());
1118 } 1120 }
1119 } 1121 }
1120 1122
1121 } // namespace blink 1123 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.cpp ('k') | third_party/WebKit/Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698