Bug 965832 - Tests. r=mbrubeck
authorJim Mathies <jmathies@mozilla.com>
Fri, 31 Jan 2014 12:10:17 -0600
changeset 182372 1e679dc9033cfd4fa3cf03569958bb251e8bc103
parent 182371 cd164c7bddb0e7e854ab46e429c045d071f4c393
child 182373 83590e071844b3261cbe1324f5f55e65fdbf2ce9
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbrubeck
bugs965832
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 965832 - Tests. r=mbrubeck
browser/metro/base/tests/mochitest/browser_flyouts.js
browser/metro/base/tests/mochitest/browser_selection_urlbar.js
browser/metro/base/tests/mochitest/metro.ini
new file mode 100644
--- /dev/null
+++ b/browser/metro/base/tests/mochitest/browser_flyouts.js
@@ -0,0 +1,44 @@
+// -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*-
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+gTests.push({
+  desc: "about flyout hides navbar, clears navbar selection, doesn't leak",
+  run: function() {
+    yield showNavBar();
+
+    let edit = document.getElementById("urlbar-edit");
+    edit.value = "http://www.wikipedia.org/";
+
+    sendElementTap(window, edit);
+
+    yield waitForCondition(function () {
+      return SelectionHelperUI.isSelectionUIVisible;
+    });
+    ok(ContextUI.navbarVisible, "nav bar visible");
+
+    let promise = waitForEvent(FlyoutPanelsUI.AboutFlyoutPanel._topmostElement, "transitionend");
+    FlyoutPanelsUI.show('AboutFlyoutPanel');
+    yield promise;
+
+    yield waitForCondition(function () {
+      return !SelectionHelperUI.isSelectionUIVisible;
+    });
+    ok(!ContextUI.navbarVisible, "nav bar hidden");
+
+    promise = waitForEvent(FlyoutPanelsUI.AboutFlyoutPanel._topmostElement, "transitionend");
+    FlyoutPanelsUI.hide('AboutFlyoutPanel');
+    yield promise;
+  }
+});
+
+function test() {
+  if (!isLandscapeMode()) {
+    todo(false, "browser_selection_tests need landscape mode to run.");
+    return;
+  }
+  runTests();
+}
--- a/browser/metro/base/tests/mochitest/browser_selection_urlbar.js
+++ b/browser/metro/base/tests/mochitest/browser_selection_urlbar.js
@@ -169,18 +169,69 @@ gTests.push({
 
     let copy = document.getElementById("context-copy");
     ok(!copy.hidden, "copy menu item is visible")
 
     let condition = getClipboardCondition("http://www.wikipedia.org/");
     let promise = waitForCondition(condition);
     sendElementTap(window, copy);
     ok((yield promise), "copy text onto clipboard")
+
+    clearSelection(edit);
+    edit.blur();
   }
 })
 
+gTests.push({
+  desc: "bug 965832 - selection monocles move with the nav bar",
+  run: function() {
+    yield showNavBar();
+
+    let originalUtils = Services.metro;
+    Services.metro = {
+      keyboardHeight: 0,
+      keyboardVisible: false
+    };
+    registerCleanupFunction(function() {
+      Services.metro = originalUtils;
+    });
+
+    let edit = document.getElementById("urlbar-edit");
+    edit.value = "http://www.wikipedia.org/";
+
+    sendElementTap(window, edit);
+    
+    let promise = waitForEvent(window, "MozDeckOffsetChanged");
+    Services.metro.keyboardHeight = 300;
+    Services.metro.keyboardVisible = true;
+    Services.obs.notifyObservers(null, "metro_softkeyboard_shown", null);
+    yield promise;
+
+    yield waitForCondition(function () {
+      return SelectionHelperUI.isSelectionUIVisible;
+    });
+
+    promise = waitForEvent(window, "MozDeckOffsetChanged");
+    Services.metro.keyboardHeight = 0;
+    Services.metro.keyboardVisible = false;
+    Services.obs.notifyObservers(null, "metro_softkeyboard_hidden", null);
+    yield promise;
+
+    yield waitForCondition(function () {
+      return SelectionHelperUI.isSelectionUIVisible;
+    });
+
+    clearSelection(edit);
+    edit.blur();
+
+    yield waitForCondition(function () {
+      return !SelectionHelperUI.isSelectionUIVisible;
+    });
+  }
+});
+
 function test() {
   if (!isLandscapeMode()) {
     todo(false, "browser_selection_tests need landscape mode to run.");
     return;
   }
   runTests();
 }
--- a/browser/metro/base/tests/mochitest/metro.ini
+++ b/browser/metro/base/tests/mochitest/metro.ini
@@ -32,16 +32,17 @@ support-files =
   res/textarea01.html
   res/testEngine.xml
   res/blankpage1.html
   res/blankpage2.html
   res/blankpage3.html
   res/documentindesignmode.html
 
 [browser_apzc_basic.js]
+[browser_flyouts.js]
 [browser_bookmarks.js]
 [browser_canonizeURL.js]
 [browser_circular_progress_indicator.js]
 [browser_colorUtils.js]
 [browser_crashprompt.js]
 [browser_context_menu_tests.js]
 [browser_context_ui.js]
 [browser_downloads.js]