|
1 // -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*- |
|
2 /* Any copyright is dedicated to the Public Domain. |
|
3 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
4 |
|
5 "use strict"; |
|
6 |
|
7 function test() { |
|
8 if (!isLandscapeMode()) { |
|
9 todo(false, "browser_snapped_tests need landscape mode to run."); |
|
10 return; |
|
11 } |
|
12 |
|
13 runTests(); |
|
14 } |
|
15 |
|
16 let kTransformTimeout = 5000; |
|
17 |
|
18 let gEdit = null; |
|
19 let tabAdded = false; |
|
20 |
|
21 function setUp() { |
|
22 if (!tabAdded) { |
|
23 yield addTab(chromeRoot + "res/textdivs01.html"); |
|
24 tabAdded = true; |
|
25 } |
|
26 yield hideContextUI(); |
|
27 } |
|
28 |
|
29 /* |
|
30 gTests.push({ |
|
31 desc: "soft keyboard reliability", |
|
32 setUp: setUp, |
|
33 run: function() { |
|
34 yield waitForMs(3000); |
|
35 |
|
36 let edit = Browser.selectedBrowser.contentDocument.getElementById("textinput"); |
|
37 // show the soft keyboard |
|
38 let keyboardPromise = waitForObserver("metro_softkeyboard_shown", 20000); |
|
39 sendNativeTap(edit); |
|
40 yield waitForMs(5000); |
|
41 sendNativeTap(edit); |
|
42 yield keyboardPromise; |
|
43 yield waitForMs(5000); |
|
44 |
|
45 // hide the soft keyboard / navbar |
|
46 keyboardPromise = waitForObserver("metro_softkeyboard_hidden", 20000); |
|
47 sendNativeTap(Browser.selectedBrowser.contentDocument.getElementById("first")); |
|
48 yield keyboardPromise; |
|
49 yield waitForMs(5000); |
|
50 }, |
|
51 tearDown: function () { |
|
52 clearNativeTouchSequence(); |
|
53 } |
|
54 }); |
|
55 */ |
|
56 |
|
57 gTests.push({ |
|
58 desc: "native long tap works", |
|
59 setUp: setUp, |
|
60 run: function() { |
|
61 let edit = Browser.selectedBrowser.contentDocument.getElementById("textinput"); |
|
62 let promise = waitForEvent(document, "popupshown"); |
|
63 sendNativeLongTap(edit); |
|
64 yield promise; |
|
65 ContextMenuUI.hide(); |
|
66 }, |
|
67 tearDown: function () { |
|
68 clearNativeTouchSequence(); |
|
69 } |
|
70 }); |
|
71 |
|
72 /* Double-tap is disabled (bug 950832). |
|
73 gTests.push({ |
|
74 desc: "double tap transforms", |
|
75 setUp: setUp, |
|
76 run: function() { |
|
77 let beginPromise = waitForObserver("apzc-transform-begin", kTransformTimeout); |
|
78 let endPromise = waitForObserver("apzc-transform-end", kTransformTimeout); |
|
79 |
|
80 sendNativeDoubleTap(Browser.selectedBrowser.contentDocument.getElementById("second")); |
|
81 |
|
82 yield beginPromise; |
|
83 yield endPromise; |
|
84 |
|
85 beginPromise = waitForObserver("apzc-transform-begin", kTransformTimeout); |
|
86 endPromise = waitForObserver("apzc-transform-end", kTransformTimeout); |
|
87 |
|
88 sendNativeDoubleTap(Browser.selectedBrowser.contentDocument.getElementById("second")); |
|
89 |
|
90 yield beginPromise; |
|
91 yield endPromise; |
|
92 }, |
|
93 tearDown: function () { |
|
94 clearNativeTouchSequence(); |
|
95 } |
|
96 }); |
|
97 */ |
|
98 |
|
99 gTests.push({ |
|
100 desc: "scroll transforms", |
|
101 setUp: setUp, |
|
102 run: function() { |
|
103 let beginPromise = waitForObserver("apzc-transform-begin", kTransformTimeout); |
|
104 let endPromise = waitForObserver("apzc-transform-end", kTransformTimeout); |
|
105 |
|
106 var touchdrag = new TouchDragAndHold(); |
|
107 touchdrag.useNativeEvents = true; |
|
108 touchdrag.nativePointerId = 1; |
|
109 yield touchdrag.start(Browser.selectedTab.browser.contentWindow, |
|
110 10, 100, 10, 10); |
|
111 touchdrag.end(); |
|
112 |
|
113 yield beginPromise; |
|
114 yield endPromise; |
|
115 }, |
|
116 tearDown: function () { |
|
117 clearNativeTouchSequence(); |
|
118 } |
|
119 }); |