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

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

Issue 2855953003: Handle long press in PDF documents. (Closed)
Patch Set: Rebase to master 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
« no previous file with comments | « chrome/browser/resources/pdf/pdf.js ('k') | pdf/out_of_process_instance.h » ('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 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 } 215 }
216
217 function testWasTwoFingerTouch() {
218 let stubElement = new StubElement();
219 let gestureDetector = new GestureDetector(stubElement);
220
221 let touchStartEvent = new MockTouchEvent('touchstart', [
222 {clientX: 0, clientY: 0, touches: []}
Kevin McNee 2017/05/03 17:25:43 The array passed to MockTouchEvent's constructor i
dsinclair 2017/05/03 18:13:38 Awesome, thanks. I'd guessed and was going to star
223 ]);
224 stubElement.sendEvent(touchStartEvent);
225 chrome.test.assertFalse(gestureDetector.wasTwoFingerTouch());
226
227 touchStartEvent = new MockTouchEvent('touchstart', [
228 {clientX: 0, clientY: 0, touches: [1, 2]}
229 ]);
230 stubElement.sendEvent(touchStartEvent);
231 chrome.test.assertTrue(gestureDetector.wasTwoFingerTouch());
232
233 touchStartEvent = new MockTouchEvent('touchstart', [
234 {clientX: 0, clientY: 0, touches: [1, 2, 3]}
235 ]);
236 stubElement.sendEvent(touchStartEvent);
237 chrome.test.assertTrue(gestureDetector.wasTwoFingerTouch());
238 }
Kevin McNee 2017/05/03 17:25:43 If you're relying on the value of |wasTwoFingerTou
dsinclair 2017/05/03 18:13:38 Ah, good idea.
216 ]; 239 ];
217 }()); 240 }());
OLDNEW
« no previous file with comments | « chrome/browser/resources/pdf/pdf.js ('k') | pdf/out_of_process_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698