summaryrefslogtreecommitdiffstats
path: root/toolkit/components/search/tests/xpcshell/test_async.js
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/search/tests/xpcshell/test_async.js')
-rw-r--r--toolkit/components/search/tests/xpcshell/test_async.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/toolkit/components/search/tests/xpcshell/test_async.js b/toolkit/components/search/tests/xpcshell/test_async.js
new file mode 100644
index 0000000000..d66d402743
--- /dev/null
+++ b/toolkit/components/search/tests/xpcshell/test_async.js
@@ -0,0 +1,36 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+add_setup(async function () {
+ await AddonTestUtils.promiseStartupManager();
+ await SearchTestUtils.useTestEngines("simple-engines");
+ Services.fog.initializeFOG();
+});
+
+add_task(async function test_async() {
+ Assert.ok(!Services.search.isInitialized);
+
+ let aStatus = await Services.search.init();
+ Assert.ok(Components.isSuccessCode(aStatus));
+ Assert.ok(Services.search.isInitialized);
+
+ // test engines from dir are not loaded.
+ let engines = await Services.search.getEngines();
+ Assert.equal(engines.length, 2);
+
+ // test jar engine is loaded ok.
+ let engine = Services.search.getEngineByName("basic");
+ Assert.notEqual(engine, null);
+ Assert.ok(engine.isAppProvided, "Should be shown as an app-provided engine");
+
+ engine = Services.search.getEngineByName("Simple Engine");
+ Assert.notEqual(engine, null);
+ Assert.ok(engine.isAppProvided, "Should be shown as an app-provided engine");
+
+ // Check if there is a value for startup_time
+ Assert.notEqual(
+ await Glean.searchService.startupTime.testGetValue(),
+ undefined,
+ "Should have a value stored in startup_time"
+ );
+});