toolkit/mozapps/update/tests/unit_aus_update/cleanupSuccessLogsFIFO.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 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 4 */
michael@0 5
michael@0 6 function run_test() {
michael@0 7 setupTestCommon();
michael@0 8
michael@0 9 logTestInfo("testing update logs are first in first out deleted");
michael@0 10
michael@0 11 writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
michael@0 12 var patches = getLocalPatchString(null, null, null, null, null, null,
michael@0 13 STATE_PENDING);
michael@0 14 var updates = getLocalUpdateString(patches);
michael@0 15 writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
michael@0 16 writeStatusFile(STATE_SUCCEEDED);
michael@0 17
michael@0 18 var dir = getUpdatesDir();
michael@0 19 var log = dir.clone();
michael@0 20 log.append(FILE_LAST_LOG);
michael@0 21 writeFile(log, "Backup Update Log");
michael@0 22
michael@0 23 log = dir.clone();
michael@0 24 log.append(FILE_BACKUP_LOG);
michael@0 25 writeFile(log, "To Be Deleted Backup Update Log");
michael@0 26
michael@0 27 log = dir.clone();
michael@0 28 log.append("0");
michael@0 29 log.append(FILE_UPDATE_LOG);
michael@0 30 writeFile(log, "Last Update Log");
michael@0 31
michael@0 32 standardInit();
michael@0 33
michael@0 34 logTestInfo("testing " + log.path + " shouldn't exist");
michael@0 35 do_check_false(log.exists());
michael@0 36
michael@0 37 log = dir.clone();
michael@0 38 log.append(FILE_LAST_LOG);
michael@0 39 logTestInfo("testing " + log.path + " should exist");
michael@0 40 do_check_true(log.exists());
michael@0 41
michael@0 42 logTestInfo("testing " + log.path + " contents");
michael@0 43 do_check_eq(readFile(log), "Last Update Log");
michael@0 44
michael@0 45 log = dir.clone();
michael@0 46 log.append(FILE_BACKUP_LOG);
michael@0 47 logTestInfo("testing " + log.path + " should exist");
michael@0 48 do_check_true(log.exists());
michael@0 49
michael@0 50 logTestInfo("testing " + log.path + " contents (bug 470979)");
michael@0 51 do_check_eq(readFile(log), "Backup Update Log");
michael@0 52
michael@0 53 dir.append("0");
michael@0 54 logTestInfo("testing " + dir.path + " should exist (bug 512994)");
michael@0 55 do_check_true(dir.exists());
michael@0 56
michael@0 57 doTestFinish();
michael@0 58 }

mercurial