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.

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

mercurial