dom/system/gonk/tests/marionette/test_screen_state.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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();

mercurial