toolkit/mozapps/update/tests/marionette/update_smoketest_ota_simple.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /* Any copyright is dedicated to the Public Domain.
     2  * http://creativecommons.org/publicdomain/zero/1.0/ */
     4 function testForceCheck() {
     5   addChromeEventListener("update-available", function(evt) {
     6     isFinishUpdate(evt.detail);
     7     statusSettingIs("check-complete", testDownload);
     8     return true;
     9   });
    10   sendContentEvent("force-update-check");
    11 }
    13 function testDownload() {
    14   let gotStarted = false, gotProgress = false, gotStopped = false;
    15   let progress = 0, total = 0;
    17   addChromeEventListener("update-download-started", function(evt) {
    18     gotStarted = true;
    19     return true;
    20   });
    21   addChromeEventListener("update-download-progress", function(evt) {
    22     progress = evt.detail.progress;
    23     total = evt.detail.total;
    24     gotProgress = true;
    25     if (total == progress) {
    26       ok(gotStarted);
    27       return true;
    28     }
    29     return false;
    30   });
    31   addChromeEventListener("update-download-stopped", function(evt) {
    32     is(evt.detail.paused, false);
    33     gotStopped = true;
    34     ok(gotStarted);
    35     ok(gotProgress);
    36     return true;
    37   });
    38   addChromeEventListener("update-downloaded", function(evt) {
    39     ok(gotStarted);
    40     ok(gotProgress);
    41     ok(gotStopped);
    42     is(progress, total);
    43     return true;
    44   });
    45   addChromeEventListener("update-prompt-apply", function(evt) {
    46     isStartToFinishUpdate(evt.detail);
    47     cleanUp();
    48   });
    49   sendContentEvent("update-available-result", {
    50     result: "download"
    51   });
    52 }
    54 function testApplied() {
    55   let finish = getFinishBuild();
    56   is(Services.appinfo.version, finish.app_version,
    57      "Services.appinfo.version should be " + finish.app_version);
    58   is(Services.appinfo.platformVersion, finish.platform_milestone,
    59      "Services.appinfo.platformVersion should be " + finish.platform_milestone);
    60   is(Services.appinfo.appBuildID, finish.app_build_id,
    61      "Services.appinfo.appBuildID should be " + finish.app_build_id);
    62   cleanUp();
    63 }
    65 // Update lifecycle callbacks
    66 function preUpdate() {
    67   testForceCheck();
    68 }
    70 function postUpdate() {
    71   testApplied();
    72 }

mercurial