From 6f3a9694c5519a49ee3f07dcf5feda1cc0908b0d Mon Sep 17 00:00:00 2001 From: JW Wang Date: Thu, 4 Jul 2013 14:47:26 +0800 Subject: [PATCH] Bug 865347 - Add a test case to test new functions. r=dhylands --- dom/system/gonk/tests/marionette/manifest.ini | 1 + .../gonk/tests/marionette/test_fakevolume.js | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 dom/system/gonk/tests/marionette/test_fakevolume.js diff --git a/dom/system/gonk/tests/marionette/manifest.ini b/dom/system/gonk/tests/marionette/manifest.ini index 0499a55955e..a0a50c70bc9 100644 --- a/dom/system/gonk/tests/marionette/manifest.ini +++ b/dom/system/gonk/tests/marionette/manifest.ini @@ -6,3 +6,4 @@ qemu = true [test_geolocation.js] disabled = Bug 808783 [test_get_voicemailInfo.js] +[test_fakevolume.js] diff --git a/dom/system/gonk/tests/marionette/test_fakevolume.js b/dom/system/gonk/tests/marionette/test_fakevolume.js new file mode 100644 index 00000000000..5ac84d92ab2 --- /dev/null +++ b/dom/system/gonk/tests/marionette/test_fakevolume.js @@ -0,0 +1,29 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +MARIONETTE_TIMEOUT = 10000; + +let Cc = SpecialPowers.Cc; +let Ci = SpecialPowers.Ci; + +let volumeService = Cc["@mozilla.org/telephony/volume-service;1"].getService(Ci.nsIVolumeService); +ok(volumeService, "Should have volume service"); + +let volName = "fake"; +let mountPoint = "/data/fake/storage"; +volumeService.createFakeVolume(volName, mountPoint); + +let vol = volumeService.getVolumeByName(volName); +ok(vol, "volume shouldn't be null"); + +is(volName, vol.name, "name"); +is(mountPoint, vol.mountPoint, "moutnPoint"); +is(Ci.nsIVolume.STATE_INIT, vol.state, "state"); + + +let oldMountGen = vol.mountGeneration; +volumeService.SetFakeVolumeState(volName, Ci.nsIVolume.STATE_MOUNTED); +is(Ci.nsIVolume.STATE_MOUNTED, vol.state, "state"); +ok(vol.mountGeneration > oldMountGen, "mount generation should be incremented"); + +finish();