Bug 1184186 - Convert robocop testDeviceSearchEngine to mochitest-chrome; r=mfinkle
authorGeoff Brown <gbrown@mozilla.com>
Mon, 03 Aug 2015 12:00:55 -0600
changeset 287622 94185637c0f3237386fe09e3761e39f0cd5b2995
parent 287621 1be9ffae5e972660c8305b842edebfd7de7fcb3c
child 287623 726366fd7c1886344f931e75498f759f743a2664
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs1184186
milestone42.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 1184186 - Convert robocop testDeviceSearchEngine to mochitest-chrome; r=mfinkle
mobile/android/tests/browser/chrome/chrome.ini
mobile/android/tests/browser/chrome/devicesearch.xml
mobile/android/tests/browser/chrome/test_device_search_engine.html
mobile/android/tests/browser/robocop/devicesearch.xml
mobile/android/tests/browser/robocop/robocop.ini
mobile/android/tests/browser/robocop/testDeviceSearchEngine.java
mobile/android/tests/browser/robocop/testDeviceSearchEngine.js
--- a/mobile/android/tests/browser/chrome/chrome.ini
+++ b/mobile/android/tests/browser/chrome/chrome.ini
@@ -1,12 +1,14 @@
 [DEFAULT]
 skip-if = os != 'android'
 support-files =
   desktopmode_user_agent.sjs
+  devicesearch.xml
 
 [test_about_logins.html]
 [test_accounts.html]
 [test_android_log.html]
 [test_app_constants.html]
 [test_debugger_server.html]
 [test_desktop_useragent.html]
+[test_device_search_engine.html]
 [test_resource_substitutions.html]
new file mode 100644
--- /dev/null
+++ b/mobile/android/tests/browser/chrome/devicesearch.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
+<ShortName>Test search engine</ShortName>
+<Description>A test search engine (based on Google search)</Description>
+<InputEncoding>UTF-8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EMwAAuEAAdX%2F%2Ff7%2F%2FP%2B%2BfDvGXQLIZgLEWgLOjlf7%2F%2F%2F%2F%2F%2F9QU90EAPQAAf8DAP0AAfMAAOUDAtr%2F%2F%2F%2F7%2B%2Fu2bCTIYwDPZgDBWQDSr4P%2F%2Fv%2F%2F%2FP5GRuABAPkAA%2FwBAfkDAPAAAesAAN%2F%2F%2B%2Fz%2F%2F%2F64g1C5VwDMYwK8Yg7y5tz8%2Fv%2FV1PYKDOcAAP0DAf4AAf0AAfYEAOwAAuAAAAD%2F%2FPvi28ymXyChTATRrIb8%2F%2F3v8fk6P8MAAdUCAvoAAP0CAP0AAfYAAO4AAACAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAA</Image>
+<Url type="text/html" method="GET" template="http://example.com/search">
+  <Param name="q" value="{searchTerms}"/>
+</Url>
+<Url type="application/x-moz-tabletsearch" method="GET" template="http://example.com/search/tablet">
+  <Param name="q" value="{searchTerms}"/>
+</Url>
+<Url type="application/x-moz-phonesearch" method="GET" template="http://example.com/search/phone">
+  <Param name="q" value="{searchTerms}"/>
+</Url>
+<SearchForm>http://example.com/</SearchForm>
+</SearchPlugin>
new file mode 100644
--- /dev/null
+++ b/mobile/android/tests/browser/chrome/test_device_search_engine.html
@@ -0,0 +1,75 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=861164
+Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
+-->
+<head>
+  <meta charset="utf-8">
+  <title>Test for Bug 861164</title>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+  <script type="application/javascript;version=1.7">
+
+  Components.utils.import("resource://gre/modules/Services.jsm");
+
+  var Cc = Components.classes;
+  var Ci = Components.interfaces;
+
+  SimpleTest.waitForExplicitFinish();
+
+  function search_observer(aSubject, aTopic, aData) {
+    let engine = aSubject.QueryInterface(Ci.nsISearchEngine);
+    info("Observer: " + aData + " for " + engine.name);
+
+    if (aData != "engine-added")
+      return;
+
+    if (engine.name != "Test search engine")
+      return;
+
+    function check_submission(aExpected, aSearchTerm, aType) {
+      is(engine.getSubmission(aSearchTerm, aType).uri.spec, "http://example.com/search" + aExpected, "submission matches");
+    }
+
+    // Force the type and check for the expected URL
+    check_submission("?q=foo", "foo", "text/html");
+    check_submission("/tablet?q=foo", "foo", "application/x-moz-tabletsearch");
+    check_submission("/phone?q=foo", "foo", "application/x-moz-phonesearch");
+
+    // Let the service pick the appropriate type based on the device
+    // and check for expected URL
+    let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
+    if (sysInfo.get("tablet")) {
+      info("Device: tablet");
+      check_submission("/tablet?q=foo", "foo", null);
+    } else {
+      info("Device: phone");
+      check_submission("/phone?q=foo", "foo", null);
+    }
+
+    SimpleTest.finish();
+  };
+
+  SimpleTest.registerCleanupFunction(function() {
+    Services.obs.removeObserver(search_observer, "browser-search-engine-modified");
+  });
+  Services.obs.addObserver(search_observer, "browser-search-engine-modified", false);
+  info("Loading search engine");
+  Services.search.addEngine("http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/devicesearch.xml", Ci.nsISearchEngine.DATA_XML, null, false);
+
+  </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=861164">Mozilla Bug 861164</a>
+<br>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1184186">Migrated from Robocop testDeviceSearchEngine</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
deleted file mode 100644
--- a/mobile/android/tests/browser/robocop/devicesearch.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
-<ShortName>Test search engine</ShortName>
-<Description>A test search engine (based on Google search)</Description>
-<InputEncoding>UTF-8</InputEncoding>
-<Image width="16" height="16">data:image/png;base64,AAABAAEAEBAAAAEAGABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADs9Pt8xetPtu9FsfFNtu%2BTzvb2%2B%2Fne4dFJeBw0egA%2FfAJAfAA8ewBBegAAAAD%2B%2FPtft98Mp%2BwWsfAVsvEbs%2FQeqvF8xO7%2F%2F%2F63yqkxdgM7gwE%2FggM%2BfQA%2BegBDeQDe7PIbotgQufcMufEPtfIPsvAbs%2FQvq%2Bfz%2Bf%2F%2B%2B%2FZKhR05hgBBhQI8hgBAgAI9ewD0%2B%2Fg3pswAtO8Cxf4Kw%2FsJvvYAqupKsNv%2B%2Fv7%2F%2FP5VkSU0iQA7jQA9hgBDgQU%2BfQH%2F%2Ff%2FQ6fM4sM4KsN8AteMCruIqqdbZ7PH8%2Fv%2Fg6Nc%2Fhg05kAA8jAM9iQI%2BhQA%2BgQDQu6b97uv%2F%2F%2F7V8Pqw3eiWz97q8%2Ff%2F%2F%2F%2F7%2FPptpkkqjQE4kwA7kAA5iwI8iAA8hQCOSSKdXjiyflbAkG7u2s%2F%2B%2F%2F39%2F%2F7r8utrqEYtjQE8lgA7kwA7kwA9jwA9igA9hACiWSekVRyeSgiYSBHx6N%2F%2B%2Fv7k7OFRmiYtlAA5lwI7lwI4lAA7kgI9jwE9iwI4iQCoVhWcTxCmb0K%2BooT8%2Fv%2F7%2F%2F%2FJ2r8fdwI1mwA3mQA3mgA8lAE8lAE4jwA9iwE%2BhwGfXifWvqz%2B%2Ff%2F58u%2Fev6Dt4tr%2B%2F%2F2ZuIUsggA7mgM6mAM3lgA5lgA6kQE%2FkwBChwHt4dv%2F%2F%2F728ei1bCi7VAC5XQ7kz7n%2F%2F%2F6bsZkgcB03lQA9lgM7kwA2iQktZToPK4r9%2F%2F%2F9%2F%2F%2FSqYK5UwDKZAS9WALIkFn%2B%2F%2F3%2F%2BP8oKccGGcIRJrERILYFEMwAAuEAAdX%2F%2Ff7%2F%2FP%2B%2BfDvGXQLIZgLEWgLOjlf7%2F%2F%2F%2F%2F%2F9QU90EAPQAAf8DAP0AAfMAAOUDAtr%2F%2F%2F%2F7%2B%2Fu2bCTIYwDPZgDBWQDSr4P%2F%2Fv%2F%2F%2FP5GRuABAPkAA%2FwBAfkDAPAAAesAAN%2F%2F%2B%2Fz%2F%2F%2F64g1C5VwDMYwK8Yg7y5tz8%2Fv%2FV1PYKDOcAAP0DAf4AAf0AAfYEAOwAAuAAAAD%2F%2FPvi28ymXyChTATRrIb8%2F%2F3v8fk6P8MAAdUCAvoAAP0CAP0AAfYAAO4AAACAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAA</Image>
-<Url type="text/html" method="GET" template="http://example.com/search">
-  <Param name="q" value="{searchTerms}"/>
-</Url>
-<Url type="application/x-moz-tabletsearch" method="GET" template="http://example.com/search/tablet">
-  <Param name="q" value="{searchTerms}"/>
-</Url>
-<Url type="application/x-moz-phonesearch" method="GET" template="http://example.com/search/phone">
-  <Param name="q" value="{searchTerms}"/>
-</Url>
-<SearchForm>http://example.com/</SearchForm>
-</SearchPlugin>
--- a/mobile/android/tests/browser/robocop/robocop.ini
+++ b/mobile/android/tests/browser/robocop/robocop.ini
@@ -108,17 +108,16 @@ skip-if = android_version == "10" || and
 # disabled on Android 2.3, bug 979552; on 4.3, bug 1145881
 skip-if = android_version == "10" || android_version == "18"
 # [testVkbOverlap.java] # see bug 907274
 
 # Using JavascriptTest
 [testBrowserDiscovery.java]
 # disabled on 4.3, bug 1158384
 skip-if = android_version == "18"
-[testDeviceSearchEngine.java]
 [testFilePicker.java]
 [testHistoryService.java]
 # disabled on 4.3, bug 1116036
 skip-if = android_version == "18"
 [testJavaAddons.java]
 [testJNI.java]
 # [testMozPay.java] # see bug 945675
 [testMigrateUI.java]
deleted file mode 100644
--- a/mobile/android/tests/browser/robocop/testDeviceSearchEngine.java
+++ /dev/null
@@ -1,11 +0,0 @@
-/* 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/. */
-
-package org.mozilla.gecko.tests;
-
-public class testDeviceSearchEngine extends JavascriptTest {
-    public testDeviceSearchEngine() {
-        super("testDeviceSearchEngine.js");
-    }
-}
deleted file mode 100644
--- a/mobile/android/tests/browser/robocop/testDeviceSearchEngine.js
+++ /dev/null
@@ -1,55 +0,0 @@
-// -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
-/* 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/. */
-
-Components.utils.import("resource://gre/modules/Services.jsm");
-
-var Cc = Components.classes;
-var Ci = Components.interfaces;
-
-function search_observer(aSubject, aTopic, aData) {
-  let engine = aSubject.QueryInterface(Ci.nsISearchEngine);
-  do_print("Observer: " + aData + " for " + engine.name);
-
-  if (aData != "engine-added")
-    return;
-
-  if (engine.name != "Test search engine")
-    return;
-
-  function check_submission(aExpected, aSearchTerm, aType) {
-    do_check_eq(engine.getSubmission(aSearchTerm, aType).uri.spec, "http://example.com/search" + aExpected);
-  }
-
-  // Force the type and check for the expected URL
-  check_submission("?q=foo", "foo", "text/html");
-  check_submission("/tablet?q=foo", "foo", "application/x-moz-tabletsearch");
-  check_submission("/phone?q=foo", "foo", "application/x-moz-phonesearch");
-
-  // Let the service pick the appropriate type based on the device
-  // and check for expected URL
-  let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
-  if (sysInfo.get("tablet")) {
-    do_print("Device: tablet");
-    check_submission("/tablet?q=foo", "foo", null);
-  } else {
-    do_print("Device: phone");
-    check_submission("/phone?q=foo", "foo", null);
-  }
-
-  run_next_test();
-};
-
-add_test(function test_default() {
-  do_register_cleanup(function cleanup() {
-    Services.obs.removeObserver(search_observer, "browser-search-engine-modified");
-  });
-
-  Services.obs.addObserver(search_observer, "browser-search-engine-modified", false);
-
-  do_print("Loading search engine");
-  Services.search.addEngine("http://mochi.test:8888/tests/robocop/devicesearch.xml", Ci.nsISearchEngine.DATA_XML, null, false);
-});
-
-run_next_test();