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

Side by Side Diff: chrome/test/data/pdf/gesture_detector_test.js

Issue 2855953003: Handle long press in PDF documents. (Closed)
Patch Set: Add long press test Created 3 years, 7 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 chrome.test.runTests(function() { 5 chrome.test.runTests(function() {
6 'use strict'; 6 'use strict';
7 7
8 class StubElement { 8 class StubElement {
9 constructor() { 9 constructor() {
10 this.listeners = new Map([ 10 this.listeners = new Map([
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 let pinchUpdateEvent = new MockTouchEvent('touchmove', [ 206 let pinchUpdateEvent = new MockTouchEvent('touchmove', [
207 {clientX: 0, clientY: 0}, 207 {clientX: 0, clientY: 0},
208 {clientX: 0, clientY: 4} 208 {clientX: 0, clientY: 4}
209 ]); 209 ]);
210 stubElement.sendEvent(pinchUpdateEvent); 210 stubElement.sendEvent(pinchUpdateEvent);
211 chrome.test.assertEq('pinchupdate', pinchListener.lastEvent.type); 211 chrome.test.assertEq('pinchupdate', pinchListener.lastEvent.type);
212 chrome.test.assertTrue(pinchUpdateEvent.defaultPrevented); 212 chrome.test.assertTrue(pinchUpdateEvent.defaultPrevented);
213 213
214 chrome.test.succeed(); 214 chrome.test.succeed();
215 },
216
217 function testWasTwoFingerTouch() {
218 let stubElement = new StubElement();
219 let gestureDetector = new GestureDetector(stubElement);
220
221
222 chrome.test.assertFalse(gestureDetector.wasTwoFingerTouch(),
223 "Should not have two finger touch before first touch event.");
224
225 stubElement.sendEvent(new MockTouchEvent('touchstart', []));
Kevin McNee 2017/05/04 15:38:55 nit: AFAIK I don't think it's possible to have a t
dsinclair 2017/05/04 17:55:54 Done.
226 chrome.test.assertFalse(gestureDetector.wasTwoFingerTouch(),
227 "Should not have a two finger touch with no touches.");
228
229 stubElement.sendEvent(new MockTouchEvent('touchstart', [
230 {clientX: 0, clientY: 0},
231 {clientX: 2, clientY: 2}]));
Kevin McNee 2017/05/04 15:38:55 nit: style. Let's be consistent in this file and u
dsinclair 2017/05/04 17:55:54 Done.
232 chrome.test.assertTrue(gestureDetector.wasTwoFingerTouch(),
233 "Should have a two finger touch.");;
Kevin McNee 2017/05/04 15:38:55 nit: double semicolon
dsinclair 2017/05/04 17:55:54 Done.
234
235 // Make sure we keep |wasTwoFingerTouch| true after the end event.
236 stubElement.sendEvent(new MockTouchEvent('touchend', []));
237 chrome.test.assertTrue(gestureDetector.wasTwoFingerTouch(),
238 "Should maintain two finger touch after touchend.");
239
240 stubElement.sendEvent(new MockTouchEvent('touchstart', [
241 {clientX: 0, clientY: 0},
242 {clientX: 2, clientY: 2},
243 {clientX: 4, clientY: 4}]));
244 chrome.test.assertFalse(gestureDetector.wasTwoFingerTouch(),
245 "Should not have two finger touch with 3 touches.");
246
247 chrome.test.succeed();
215 } 248 }
216 ]; 249 ];
217 }()); 250 }());
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698