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

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') | chrome/test/data/pdf/touch_handling_test.js » ('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 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', [
226 {clientX: 0, clientY: 0}
227 ]));
228 chrome.test.assertFalse(gestureDetector.wasTwoFingerTouch(),
229 "Should not have a two finger touch with one touch.");
230
231 stubElement.sendEvent(new MockTouchEvent('touchstart', [
232 {clientX: 0, clientY: 0},
233 {clientX: 2, clientY: 2}
234 ]));
235 chrome.test.assertTrue(gestureDetector.wasTwoFingerTouch(),
236 "Should have a two finger touch.");
237
238 // Make sure we keep |wasTwoFingerTouch| true after the end event.
239 stubElement.sendEvent(new MockTouchEvent('touchend', []));
240 chrome.test.assertTrue(gestureDetector.wasTwoFingerTouch(),
241 "Should maintain two finger touch after touchend.");
242
243 stubElement.sendEvent(new MockTouchEvent('touchstart', [
244 {clientX: 0, clientY: 0},
245 {clientX: 2, clientY: 2},
246 {clientX: 4, clientY: 4}
247 ]));
248 chrome.test.assertFalse(gestureDetector.wasTwoFingerTouch(),
249 "Should not have two finger touch with 3 touches.");
250
251 chrome.test.succeed();
215 } 252 }
216 ]; 253 ];
217 }()); 254 }());
OLDNEW
« no previous file with comments | « chrome/browser/resources/pdf/pdf.js ('k') | chrome/test/data/pdf/touch_handling_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698