Bug 1406181 - Test storage.local telemetry on file and indexedDB backends. r=aswan
authorLuca Greco <lgreco@mozilla.com>
Thu, 19 Oct 2017 15:46:51 +0200
changeset 421616 645c311bf4ca9057572d2cd947eb7dd0c23069c3
parent 421615 85a31c13073a82398f2b41dd047fe899d60c372b
child 421617 077af955cd73eb5d16e9d42079c6e244d2017b69
push id34099
push userncsoregi@mozilla.com
push dateWed, 06 Jun 2018 22:00:08 +0000
treeherdermozilla-central@1ab062fd31db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaswan
bugs1406181
milestone62.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 1406181 - Test storage.local telemetry on file and indexedDB backends. r=aswan MozReview-Commit-ID: AHSPICGKdib
toolkit/components/extensions/test/xpcshell/test_ext_storage_telemetry.js
--- a/toolkit/components/extensions/test/xpcshell/test_ext_storage_telemetry.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_storage_telemetry.js
@@ -1,17 +1,19 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
+ChromeUtils.import("resource://gre/modules/ExtensionStorageIDB.jsm");
+
 const HISTOGRAM_IDS = [
   "WEBEXT_STORAGE_LOCAL_SET_MS", "WEBEXT_STORAGE_LOCAL_GET_MS",
 ];
 
-add_task(async function test_telemetry_background() {
+async function test_telemetry_background() {
   const server = createHttpServer();
   server.registerDirectory("/data/", do_get_file("data"));
 
   const BASE_URL = `http://localhost:${server.identity.primaryPort}/data`;
 
   async function contentScript() {
     await browser.storage.local.set({a: "b"});
     await browser.storage.local.get("a");
@@ -96,9 +98,19 @@ add_task(async function test_telemetry_b
   // Telemetry from extension1's content script should be recorded.
   snapshots = getSnapshots(process);
   for (let id of HISTOGRAM_IDS) {
     equal(arraySum(snapshots[id].counts), expectedCount,
           `Data recorded in content script for histogram: ${id}.`);
   }
 
   await extension1.unload();
+}
+
+add_task(function test_telemetry_background_file_backend() {
+  return runWithPrefs([[ExtensionStorageIDB.BACKEND_ENABLED_PREF, false]],
+                      test_telemetry_background);
 });
+
+add_task(function test_telemetry_background_idb_backend() {
+  return runWithPrefs([[ExtensionStorageIDB.BACKEND_ENABLED_PREF, true]],
+                      test_telemetry_background);
+});