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

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: Rebase Created 3 years, 11 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) 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 5863 matching lines...) Expand 10 before | Expand all | Expand 10 after
5874 m_triggered = true; 5874 m_triggered = true;
5875 return true; 5875 return true;
5876 } 5876 }
5877 5877
5878 bool triggered() const { return m_triggered; } 5878 bool triggered() const { return m_triggered; }
5879 void resetTriggered() { m_triggered = false; } 5879 void resetTriggered() { m_triggered = false; }
5880 bool m_triggered; 5880 bool m_triggered;
5881 }; 5881 };
5882 5882
5883 static WebGestureEvent fatTap(int x, int y) { 5883 static WebGestureEvent fatTap(int x, int y) {
5884 WebGestureEvent event; 5884 WebGestureEvent event(WebInputEvent::GestureTap, WebInputEvent::NoModifiers,
5885 event.type = WebInputEvent::GestureTap; 5885 WebInputEvent::TimeStampForTesting);
5886 event.sourceDevice = WebGestureDeviceTouchscreen; 5886 event.sourceDevice = WebGestureDeviceTouchscreen;
5887 event.x = x; 5887 event.x = x;
5888 event.y = y; 5888 event.y = y;
5889 event.data.tap.width = 50; 5889 event.data.tap.width = 50;
5890 event.data.tap.height = 50; 5890 event.data.tap.height = 50;
5891 return event; 5891 return event;
5892 } 5892 }
5893 5893
5894 TEST_P(ParameterizedWebFrameTest, DisambiguationPopup) { 5894 TEST_P(ParameterizedWebFrameTest, DisambiguationPopup) {
5895 const std::string htmlFile = "disambiguation_popup.html"; 5895 const std::string htmlFile = "disambiguation_popup.html";
(...skipping 3827 matching lines...) Expand 10 before | Expand all | Expand 10 after
9723 const WebFloatSize&)); 9723 const WebFloatSize&));
9724 }; 9724 };
9725 9725
9726 class WebFrameOverscrollTest 9726 class WebFrameOverscrollTest
9727 : public WebFrameTest, 9727 : public WebFrameTest,
9728 public ::testing::WithParamInterface<blink::WebGestureDevice> { 9728 public ::testing::WithParamInterface<blink::WebGestureDevice> {
9729 protected: 9729 protected:
9730 WebGestureEvent generateEvent(WebInputEvent::Type type, 9730 WebGestureEvent generateEvent(WebInputEvent::Type type,
9731 float deltaX = 0.0, 9731 float deltaX = 0.0,
9732 float deltaY = 0.0) { 9732 float deltaY = 0.0) {
9733 WebGestureEvent event; 9733 WebGestureEvent event(type, WebInputEvent::NoModifiers,
9734 event.type = type; 9734 WebInputEvent::TimeStampForTesting);
9735 // TODO(wjmaclean): Make sure that touchpad device is only ever used for 9735 // TODO(wjmaclean): Make sure that touchpad device is only ever used for
9736 // gesture scrolling event types. 9736 // gesture scrolling event types.
9737 event.sourceDevice = GetParam(); 9737 event.sourceDevice = GetParam();
9738 event.x = 100; 9738 event.x = 100;
9739 event.y = 100; 9739 event.y = 100;
9740 if (type == WebInputEvent::GestureScrollUpdate) { 9740 if (type == WebInputEvent::GestureScrollUpdate) {
9741 event.data.scrollUpdate.deltaX = deltaX; 9741 event.data.scrollUpdate.deltaX = deltaX;
9742 event.data.scrollUpdate.deltaY = deltaY; 9742 event.data.scrollUpdate.deltaY = deltaY;
9743 } 9743 }
9744 return event; 9744 return event;
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after
10663 TEST_F(WebFrameTest, ScrollBeforeLayoutDoesntCrash) { 10663 TEST_F(WebFrameTest, ScrollBeforeLayoutDoesntCrash) {
10664 registerMockedHttpURLLoad("display-none.html"); 10664 registerMockedHttpURLLoad("display-none.html");
10665 FrameTestHelpers::WebViewHelper webViewHelper; 10665 FrameTestHelpers::WebViewHelper webViewHelper;
10666 webViewHelper.initializeAndLoad(m_baseURL + "display-none.html"); 10666 webViewHelper.initializeAndLoad(m_baseURL + "display-none.html");
10667 WebViewImpl* webView = webViewHelper.webView(); 10667 WebViewImpl* webView = webViewHelper.webView();
10668 webViewHelper.resize(WebSize(640, 480)); 10668 webViewHelper.resize(WebSize(640, 480));
10669 10669
10670 Document* document = webView->mainFrameImpl()->frame()->document(); 10670 Document* document = webView->mainFrameImpl()->frame()->document();
10671 document->documentElement()->setLayoutObject(nullptr); 10671 document->documentElement()->setLayoutObject(nullptr);
10672 10672
10673 WebGestureEvent beginEvent; 10673 WebGestureEvent beginEvent(WebInputEvent::GestureScrollBegin,
10674 beginEvent.type = WebInputEvent::GestureScrollEnd; 10674 WebInputEvent::NoModifiers,
10675 WebInputEvent::TimeStampForTesting);
10675 beginEvent.sourceDevice = WebGestureDeviceTouchpad; 10676 beginEvent.sourceDevice = WebGestureDeviceTouchpad;
10676 WebGestureEvent updateEvent; 10677 WebGestureEvent updateEvent(WebInputEvent::GestureScrollUpdate,
10677 updateEvent.type = WebInputEvent::GestureScrollEnd; 10678 WebInputEvent::NoModifiers,
10679 WebInputEvent::TimeStampForTesting);
10678 updateEvent.sourceDevice = WebGestureDeviceTouchpad; 10680 updateEvent.sourceDevice = WebGestureDeviceTouchpad;
10679 WebGestureEvent endEvent; 10681 WebGestureEvent endEvent(WebInputEvent::GestureScrollEnd,
10680 endEvent.type = WebInputEvent::GestureScrollEnd; 10682 WebInputEvent::NoModifiers,
10683 WebInputEvent::TimeStampForTesting);
10681 endEvent.sourceDevice = WebGestureDeviceTouchpad; 10684 endEvent.sourceDevice = WebGestureDeviceTouchpad;
10682 10685
10683 // Try GestureScrollEnd and GestureScrollUpdate first to make sure that not 10686 // Try GestureScrollEnd and GestureScrollUpdate first to make sure that not
10684 // seeing a Begin first doesn't break anything. (This currently happens). 10687 // seeing a Begin first doesn't break anything. (This currently happens).
10685 webViewHelper.webView()->handleInputEvent(endEvent); 10688 webViewHelper.webView()->handleInputEvent(endEvent);
10686 webViewHelper.webView()->handleInputEvent(updateEvent); 10689 webViewHelper.webView()->handleInputEvent(updateEvent);
10687 10690
10688 // Try a full Begin/Update/End cycle. 10691 // Try a full Begin/Update/End cycle.
10689 webViewHelper.webView()->handleInputEvent(beginEvent); 10692 webViewHelper.webView()->handleInputEvent(beginEvent);
10690 webViewHelper.webView()->handleInputEvent(updateEvent); 10693 webViewHelper.webView()->handleInputEvent(updateEvent);
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
11161 11164
11162 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); 11165 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached());
11163 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); 11166 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading());
11164 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); 11167 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad());
11165 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); 11168 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents());
11166 11169
11167 webViewHelper.reset(); 11170 webViewHelper.reset();
11168 } 11171 }
11169 11172
11170 } // namespace blink 11173 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698