Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/ */
4 MARIONETTE_TIMEOUT = 10000;
6 let Services = SpecialPowers.Services;
8 function testScreenState(on, expected, msg) {
9 // send event to RadioInterface
10 Services.obs.notifyObservers(null, 'screen-state-changed', on);
11 // maybe rild/qemu needs some time to process the event
12 window.setTimeout(function() {
13 runEmulatorCmd('gsm report creg', function(result) {
14 is(result.pop(), 'OK', '\'gsm report creg\' successful');
15 ok(result.indexOf(expected) !== -1, msg);
16 runNextTest();
17 })}, 1000);
18 }
20 function testScreenStateDisabled() {
21 testScreenState('off', '+CREG: 1', 'screen is disabled');
22 }
24 function testScreenStateEnabled() {
25 testScreenState('on', '+CREG: 2', 'screen is enabled');
26 }
28 let tests = [
29 testScreenStateDisabled,
30 testScreenStateEnabled
31 ];
33 function runNextTest() {
34 let test = tests.shift();
35 if (!test) {
36 cleanUp();
37 return;
38 }
40 test();
41 }
43 function cleanUp() {
44 finish();
45 }
47 runNextTest();