summaryrefslogtreecommitdiffstats
path: root/b2g/components/test/unit/head_logshake_gonk.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /b2g/components/test/unit/head_logshake_gonk.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'b2g/components/test/unit/head_logshake_gonk.js')
-rw-r--r--b2g/components/test/unit/head_logshake_gonk.js58
1 files changed, 58 insertions, 0 deletions
diff --git a/b2g/components/test/unit/head_logshake_gonk.js b/b2g/components/test/unit/head_logshake_gonk.js
new file mode 100644
index 000000000..e94234f1f
--- /dev/null
+++ b/b2g/components/test/unit/head_logshake_gonk.js
@@ -0,0 +1,58 @@
+/**
+ * Boostrap LogShake's tests that need gonk support.
+ * This is creating a fake sdcard for LogShake tests and importing LogShake and
+ * osfile
+ */
+
+/* jshint moz: true */
+/* global Components, LogCapture, LogShake, ok, add_test, run_next_test, dump,
+ do_get_profile, OS, volumeService, equal, XPCOMUtils */
+/* exported setup_logshake_mocks */
+
+/* disable use strict warning */
+/* jshint -W097 */
+
+"use strict";
+
+var Cu = Components.utils;
+var Ci = Components.interfaces;
+var Cc = Components.classes;
+
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/osfile.jsm");
+
+XPCOMUtils.defineLazyServiceGetter(this, "volumeService",
+ "@mozilla.org/telephony/volume-service;1",
+ "nsIVolumeService");
+
+var sdcard;
+
+function setup_logshake_mocks() {
+ do_get_profile();
+ setup_fs();
+}
+
+function setup_fs() {
+ OS.File.makeDir("/data/local/tmp/sdcard/", {from: "/data"}).then(function() {
+ setup_sdcard();
+ });
+}
+
+function setup_sdcard() {
+ let volName = "sdcard";
+ let mountPoint = "/data/local/tmp/sdcard";
+ volumeService.createFakeVolume(volName, mountPoint);
+
+ let vol = volumeService.getVolumeByName(volName);
+ ok(vol, "volume shouldn't be null");
+ equal(volName, vol.name, "name");
+ equal(Ci.nsIVolume.STATE_MOUNTED, vol.state, "state");
+
+ ensure_sdcard();
+}
+
+function ensure_sdcard() {
+ sdcard = volumeService.getVolumeByName("sdcard").mountPoint;
+ ok(sdcard, "Should have a valid sdcard mountpoint");
+ run_next_test();
+}