summaryrefslogtreecommitdiffstats
path: root/browser/components/search/test/marionette
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--browser/components/search/test/marionette/manifest.ini4
-rw-r--r--browser/components/search/test/marionette/test_engines_on_restart.py40
2 files changed, 44 insertions, 0 deletions
diff --git a/browser/components/search/test/marionette/manifest.ini b/browser/components/search/test/marionette/manifest.ini
new file mode 100644
index 0000000000..3ca0ae0eb5
--- /dev/null
+++ b/browser/components/search/test/marionette/manifest.ini
@@ -0,0 +1,4 @@
+[DEFAULT]
+run-if = buildapp == 'browser'
+
+[test_engines_on_restart.py]
diff --git a/browser/components/search/test/marionette/test_engines_on_restart.py b/browser/components/search/test/marionette/test_engines_on_restart.py
new file mode 100644
index 0000000000..d7a0634e75
--- /dev/null
+++ b/browser/components/search/test/marionette/test_engines_on_restart.py
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+# 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/.
+
+import textwrap
+
+from marionette_harness.marionette_test import MarionetteTestCase
+
+
+class TestEnginesOnRestart(MarionetteTestCase):
+ def setUp(self):
+ super(TestEnginesOnRestart, self).setUp()
+ self.marionette.enforce_gecko_prefs(
+ {
+ "browser.search.log": True,
+ }
+ )
+
+ def get_default_search_engine(self):
+ """Retrieve the identifier of the default search engine."""
+
+ script = """\
+ let [resolve] = arguments;
+ let searchService = Components.classes[
+ "@mozilla.org/browser/search-service;1"]
+ .getService(Components.interfaces.nsISearchService);
+ return searchService.init().then(function () {
+ resolve(searchService.defaultEngine.identifier);
+ });
+ """
+
+ with self.marionette.using_context(self.marionette.CONTEXT_CHROME):
+ return self.marionette.execute_async_script(textwrap.dedent(script))
+
+ def test_engines(self):
+ self.assertTrue(self.get_default_search_engine().startswith("google"))
+ self.marionette.set_pref("intl.locale.requested", "kk_KZ")
+ self.marionette.restart(clean=False, in_app=True)
+ self.assertTrue(self.get_default_search_engine().startswith("google"))