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

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

Issue 2569273002: Add constructors to WebInputEvents and setters so we can work at cleaning up these public structs. (Closed)
Patch Set: Fix mouse up event sender not modifying modifiers Created 4 years 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 5861 matching lines...) Expand 10 before | Expand all | Expand 10 after
5872 m_triggered = true; 5872 m_triggered = true;
5873 return true; 5873 return true;
5874 } 5874 }
5875 5875
5876 bool triggered() const { return m_triggered; } 5876 bool triggered() const { return m_triggered; }
5877 void resetTriggered() { m_triggered = false; } 5877 void resetTriggered() { m_triggered = false; }
5878 bool m_triggered; 5878 bool m_triggered;
5879 }; 5879 };
5880 5880
5881 static WebGestureEvent fatTap(int x, int y) { 5881 static WebGestureEvent fatTap(int x, int y) {
5882 WebGestureEvent event; 5882 WebGestureEvent event(WebInputEvent::GestureTap, WebInputEvent::NoModifiers,
5883 event.type = WebInputEvent::GestureTap; 5883 WebInputEvent::TimeStampForTesting);
5884 event.sourceDevice = WebGestureDeviceTouchscreen; 5884 event.sourceDevice = WebGestureDeviceTouchscreen;
5885 event.x = x; 5885 event.x = x;
5886 event.y = y; 5886 event.y = y;
5887 event.data.tap.width = 50; 5887 event.data.tap.width = 50;
5888 event.data.tap.height = 50; 5888 event.data.tap.height = 50;
5889 return event; 5889 return event;
5890 } 5890 }
5891 5891
5892 TEST_P(ParameterizedWebFrameTest, DisambiguationPopup) { 5892 TEST_P(ParameterizedWebFrameTest, DisambiguationPopup) {
5893 const std::string htmlFile = "disambiguation_popup.html"; 5893 const std::string htmlFile = "disambiguation_popup.html";
(...skipping 3825 matching lines...) Expand 10 before | Expand all | Expand 10 after
9719 const WebFloatSize&)); 9719 const WebFloatSize&));
9720 }; 9720 };
9721 9721
9722 class WebFrameOverscrollTest 9722 class WebFrameOverscrollTest
9723 : public WebFrameTest, 9723 : public WebFrameTest,
9724 public ::testing::WithParamInterface<blink::WebGestureDevice> { 9724 public ::testing::WithParamInterface<blink::WebGestureDevice> {
9725 protected: 9725 protected:
9726 WebGestureEvent generateEvent(WebInputEvent::Type type, 9726 WebGestureEvent generateEvent(WebInputEvent::Type type,
9727 float deltaX = 0.0, 9727 float deltaX = 0.0,
9728 float deltaY = 0.0) { 9728 float deltaY = 0.0) {
9729 WebGestureEvent event; 9729 WebGestureEvent event(type, WebInputEvent::NoModifiers,
9730 event.type = type; 9730 WebInputEvent::TimeStampForTesting);
9731 // TODO(wjmaclean): Make sure that touchpad device is only ever used for 9731 // TODO(wjmaclean): Make sure that touchpad device is only ever used for
9732 // gesture scrolling event types. 9732 // gesture scrolling event types.
9733 event.sourceDevice = GetParam(); 9733 event.sourceDevice = GetParam();
9734 event.x = 100; 9734 event.x = 100;
9735 event.y = 100; 9735 event.y = 100;
9736 if (type == WebInputEvent::GestureScrollUpdate) { 9736 if (type == WebInputEvent::GestureScrollUpdate) {
9737 event.data.scrollUpdate.deltaX = deltaX; 9737 event.data.scrollUpdate.deltaX = deltaX;
9738 event.data.scrollUpdate.deltaY = deltaY; 9738 event.data.scrollUpdate.deltaY = deltaY;
9739 } 9739 }
9740 return event; 9740 return event;
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after
10659 TEST_F(WebFrameTest, ScrollBeforeLayoutDoesntCrash) { 10659 TEST_F(WebFrameTest, ScrollBeforeLayoutDoesntCrash) {
10660 registerMockedHttpURLLoad("display-none.html"); 10660 registerMockedHttpURLLoad("display-none.html");
10661 FrameTestHelpers::WebViewHelper webViewHelper; 10661 FrameTestHelpers::WebViewHelper webViewHelper;
10662 webViewHelper.initializeAndLoad(m_baseURL + "display-none.html"); 10662 webViewHelper.initializeAndLoad(m_baseURL + "display-none.html");
10663 WebViewImpl* webView = webViewHelper.webView(); 10663 WebViewImpl* webView = webViewHelper.webView();
10664 webViewHelper.resize(WebSize(640, 480)); 10664 webViewHelper.resize(WebSize(640, 480));
10665 10665
10666 Document* document = webView->mainFrameImpl()->frame()->document(); 10666 Document* document = webView->mainFrameImpl()->frame()->document();
10667 document->documentElement()->setLayoutObject(nullptr); 10667 document->documentElement()->setLayoutObject(nullptr);
10668 10668
10669 WebGestureEvent beginEvent; 10669 WebGestureEvent beginEvent(WebInputEvent::GestureScrollBegin,
10670 beginEvent.type = WebInputEvent::GestureScrollEnd; 10670 WebInputEvent::NoModifiers,
10671 WebInputEvent::TimeStampForTesting);
10671 beginEvent.sourceDevice = WebGestureDeviceTouchpad; 10672 beginEvent.sourceDevice = WebGestureDeviceTouchpad;
10672 WebGestureEvent updateEvent; 10673 WebGestureEvent updateEvent(WebInputEvent::GestureScrollUpdate,
10673 updateEvent.type = WebInputEvent::GestureScrollEnd; 10674 WebInputEvent::NoModifiers,
10675 WebInputEvent::TimeStampForTesting);
10674 updateEvent.sourceDevice = WebGestureDeviceTouchpad; 10676 updateEvent.sourceDevice = WebGestureDeviceTouchpad;
10675 WebGestureEvent endEvent; 10677 WebGestureEvent endEvent(WebInputEvent::GestureScrollEnd,
10676 endEvent.type = WebInputEvent::GestureScrollEnd; 10678 WebInputEvent::NoModifiers,
10679 WebInputEvent::TimeStampForTesting);
10677 endEvent.sourceDevice = WebGestureDeviceTouchpad; 10680 endEvent.sourceDevice = WebGestureDeviceTouchpad;
10678 10681
10679 // Try GestureScrollEnd and GestureScrollUpdate first to make sure that not 10682 // Try GestureScrollEnd and GestureScrollUpdate first to make sure that not
10680 // seeing a Begin first doesn't break anything. (This currently happens). 10683 // seeing a Begin first doesn't break anything. (This currently happens).
10681 webViewHelper.webView()->handleInputEvent(endEvent); 10684 webViewHelper.webView()->handleInputEvent(endEvent);
10682 webViewHelper.webView()->handleInputEvent(updateEvent); 10685 webViewHelper.webView()->handleInputEvent(updateEvent);
10683 10686
10684 // Try a full Begin/Update/End cycle. 10687 // Try a full Begin/Update/End cycle.
10685 webViewHelper.webView()->handleInputEvent(beginEvent); 10688 webViewHelper.webView()->handleInputEvent(beginEvent);
10686 webViewHelper.webView()->handleInputEvent(updateEvent); 10689 webViewHelper.webView()->handleInputEvent(updateEvent);
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
11094 11097
11095 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); 11098 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached());
11096 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); 11099 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading());
11097 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); 11100 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad());
11098 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); 11101 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents());
11099 11102
11100 webViewHelper.reset(); 11103 webViewHelper.reset();
11101 } 11104 }
11102 11105
11103 } // namespace blink 11106 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698