michael@0: // -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*- michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: "use strict"; michael@0: michael@0: function test() { michael@0: if (!isLandscapeMode()) { michael@0: todo(false, "browser_snapped_tests need landscape mode to run."); michael@0: return; michael@0: } michael@0: michael@0: runTests(); michael@0: } michael@0: michael@0: let kTransformTimeout = 5000; michael@0: michael@0: let gEdit = null; michael@0: let tabAdded = false; michael@0: michael@0: function setUp() { michael@0: if (!tabAdded) { michael@0: yield addTab(chromeRoot + "res/textdivs01.html"); michael@0: tabAdded = true; michael@0: } michael@0: yield hideContextUI(); michael@0: } michael@0: michael@0: /* michael@0: gTests.push({ michael@0: desc: "soft keyboard reliability", michael@0: setUp: setUp, michael@0: run: function() { michael@0: yield waitForMs(3000); michael@0: michael@0: let edit = Browser.selectedBrowser.contentDocument.getElementById("textinput"); michael@0: // show the soft keyboard michael@0: let keyboardPromise = waitForObserver("metro_softkeyboard_shown", 20000); michael@0: sendNativeTap(edit); michael@0: yield waitForMs(5000); michael@0: sendNativeTap(edit); michael@0: yield keyboardPromise; michael@0: yield waitForMs(5000); michael@0: michael@0: // hide the soft keyboard / navbar michael@0: keyboardPromise = waitForObserver("metro_softkeyboard_hidden", 20000); michael@0: sendNativeTap(Browser.selectedBrowser.contentDocument.getElementById("first")); michael@0: yield keyboardPromise; michael@0: yield waitForMs(5000); michael@0: }, michael@0: tearDown: function () { michael@0: clearNativeTouchSequence(); michael@0: } michael@0: }); michael@0: */ michael@0: michael@0: gTests.push({ michael@0: desc: "native long tap works", michael@0: setUp: setUp, michael@0: run: function() { michael@0: let edit = Browser.selectedBrowser.contentDocument.getElementById("textinput"); michael@0: let promise = waitForEvent(document, "popupshown"); michael@0: sendNativeLongTap(edit); michael@0: yield promise; michael@0: ContextMenuUI.hide(); michael@0: }, michael@0: tearDown: function () { michael@0: clearNativeTouchSequence(); michael@0: } michael@0: }); michael@0: michael@0: /* Double-tap is disabled (bug 950832). michael@0: gTests.push({ michael@0: desc: "double tap transforms", michael@0: setUp: setUp, michael@0: run: function() { michael@0: let beginPromise = waitForObserver("apzc-transform-begin", kTransformTimeout); michael@0: let endPromise = waitForObserver("apzc-transform-end", kTransformTimeout); michael@0: michael@0: sendNativeDoubleTap(Browser.selectedBrowser.contentDocument.getElementById("second")); michael@0: michael@0: yield beginPromise; michael@0: yield endPromise; michael@0: michael@0: beginPromise = waitForObserver("apzc-transform-begin", kTransformTimeout); michael@0: endPromise = waitForObserver("apzc-transform-end", kTransformTimeout); michael@0: michael@0: sendNativeDoubleTap(Browser.selectedBrowser.contentDocument.getElementById("second")); michael@0: michael@0: yield beginPromise; michael@0: yield endPromise; michael@0: }, michael@0: tearDown: function () { michael@0: clearNativeTouchSequence(); michael@0: } michael@0: }); michael@0: */ michael@0: michael@0: gTests.push({ michael@0: desc: "scroll transforms", michael@0: setUp: setUp, michael@0: run: function() { michael@0: let beginPromise = waitForObserver("apzc-transform-begin", kTransformTimeout); michael@0: let endPromise = waitForObserver("apzc-transform-end", kTransformTimeout); michael@0: michael@0: var touchdrag = new TouchDragAndHold(); michael@0: touchdrag.useNativeEvents = true; michael@0: touchdrag.nativePointerId = 1; michael@0: yield touchdrag.start(Browser.selectedTab.browser.contentWindow, michael@0: 10, 100, 10, 10); michael@0: touchdrag.end(); michael@0: michael@0: yield beginPromise; michael@0: yield endPromise; michael@0: }, michael@0: tearDown: function () { michael@0: clearNativeTouchSequence(); michael@0: } michael@0: });