browser/metro/base/tests/mochitest/browser_apzc_basic.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial