mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
30f7e10db1
- Bug 937810 - disable application reputation check on b2g r=mmc,mossop (403f8e0353) - Bug 1216537 - Check and request storage permission if file download is started. r=nalexander,paolo (9233e7193d) - Bug 1163937 - Added forceSave function to DownloadIntegration and ensured that downloads removed in Sanitizer do not persist. r=margaret (9610017b5d) - Bug 989960 - Unhandled rejections in DOM Promises should cause xpcshell tests to fail. r=Yoric (be260d55d2) - Bug 1177237 - Implement OS query parsing and user search choice. r=jaws (86c807e606) - Bug 1177443 - Add 'system' purpose for searches coming from outside Firefox, r=MattN. (f6ac86ec2a) - Bug 1072037, part 2 - Tests for the effect of setting CSS animation's AnimationPlayer.currentTime. r=birtles (79639d2ea4) - bits of Bug 1145246, part 2 (849519f25d) - bits of Bug 1145246, part 7 (3ec5500e08) - bits of Bug 1109390 part 5 (6d849b9b3c) - Bug 1074630, part 2 - CSS animations tests for Web Animations finishing behavior. r=birtles (bd0aa575bd) - Bug 1073379, part 6 - Tests for the effect of setting CSS animation's AnimationPlayer.startTime. r=dholbert (9d8aad8d28) - Bug 1073379, part 6b - Re-enable the player.playState check in checkStateAtActiveIntervalEndTime, but disable the first checkStateAtActiveIntervalEndTime call in the 'Skipping backwards through animation' tests. r=orange (3a9ea58cef) - Bug 1141710, part 1 - Update to the new version of addDiv() in testcommon.js. r=dholbert (262b9dc018) - Bug 1141710, part 2 - Update comments to be non-Mozilla specific. r=dholbert (177e8818f8) - Bug 1141710, part 3 - Stop using ECMAScript 6 features in test_animation-player-starttime.html, since other browsers don't support them. r=dholbert (6f0c6ab687) - Bug 1141710, part 4 - Avoid race condition when taking timestamps by reusing the original timestamp. r=dholbert (bc6ff2f3b1) - Bug 1141710, part 5 - Change from assert_true() to the new assert_unreached(). r=dholbert (0c1608c4c4) - Bug 1141710, part 7 - Create helpers to get the startTime corresponding to various points through the active duration. r=dholbert (568cf9a054) - Bug 1141710, part 7 - Store the generated 'animation' property string in a global constant and reuse that constant. r=dholbert (ce85c0d7a9) - Bug 1141710, part 8 - Create helpers to get the startTime corresponding to various points through the active duration. r=dholbert (6d6b1625ff) - Bug 1141710, part 9 - Get the timeline from the player instead of from the document. r=dholbert (9660c00f1d) - Bug 1141710, part 10 - Update some assertion text and comments. r=birtles (d238a482b5) - Bug 1141710, part 11 - Assert that seeking over the before and active phases worked. r=birtles (4aedf388f9) - Bug 1141710, part 12 - Check that the hold time is updated when the startTime is set to null. r=birtles (0473baeabd) - Bug 1141710, part 13 - Wrap all lines at the 80 column mark. r=birtles (7d3ed6b453) - Bug 1141710, part 14 - Get rid of the checks at 90% through the active duration. r=birtles (0f3c4cb7ca) - part of Bug 1145246, part 2 - (ec09bf3fdd) - half of Bug 1109390 part 1 - Add tests for getting the startTime; r=jwatt (a682851ba6) - Bug 1149832 - Replace the Web Animations test helper waitForTwoAnimationFrames() with a helper that takes a frame count. r=birtles (da312eae7d) - Bug 1235286 - Part 1: Add an argument to waitForAnimationFrames to run a task in each requestAnimationFrame callback. r=birtles (199a789546) - Bug 1235286 - Part 2: Tests for animation optimizations. r=birtles (e510c68a7c) - Bug 1235286 - Part 3: Comment out some compositor animations tests. r=birtles (61791d5b69) - Bug 1235345 - Remove services/metrics. r=gfritzsche (29ac4a5895) - Bug 1204846 - Modify the NetworkStatsDB to allow getSamples returns expired data at first sample and modify the test case. r=ethan (3e9d1f9a77) - Bug 1237227 - Check the return of context->GetDisplayRootPresContext() for validity. r=roc (2ad8dcf545) - sync parts of AppConstants.jsm for isPlatformAndVersion* functions
108 lines
4.1 KiB
JavaScript
108 lines
4.1 KiB
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
"use strict";
|
|
|
|
Components.utils.import("resource://gre/modules/PromiseUtils.jsm");
|
|
Components.utils.import("resource://gre/modules/Timer.jsm");
|
|
Components.utils.import("resource://testing-common/PromiseTestUtils.jsm");
|
|
|
|
// Tests for PromiseUtils.jsm
|
|
function run_test() {
|
|
run_next_test();
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////
|
|
// Tests for PromiseUtils.defer()
|
|
///////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
/* Tests for checking the resolve method of the Deferred object
|
|
* returned by PromiseUtils.defer() */
|
|
add_task(function* test_resolve_string() {
|
|
let def = PromiseUtils.defer();
|
|
let expected = "The promise is resolved " + Math.random();
|
|
def.resolve(expected);
|
|
let result = yield def.promise;
|
|
Assert.equal(result, expected, "def.resolve() resolves the promise");
|
|
});
|
|
|
|
/* Test for the case when undefined is passed to the resolve method
|
|
* of the Deferred object */
|
|
add_task(function* test_resolve_undefined() {
|
|
let def = PromiseUtils.defer();
|
|
def.resolve();
|
|
let result = yield def.promise;
|
|
Assert.equal(result, undefined, "resolve works with undefined as well");
|
|
});
|
|
|
|
/* Test when a pending promise is passed to the resolve method
|
|
* of the Deferred object */
|
|
add_task(function* test_resolve_pending_promise() {
|
|
let def = PromiseUtils.defer();
|
|
let expected = 100 + Math.random();
|
|
let p = new Promise((resolve, reject) => {
|
|
setTimeout(() => resolve(expected), 100);
|
|
});
|
|
def.resolve(p);
|
|
let result = yield def.promise;
|
|
Assert.equal(result, expected, "def.promise assumed the state of the passed promise");
|
|
});
|
|
|
|
/* Test when a resovled promise is passed
|
|
* to the resolve method of the Deferred object */
|
|
add_task(function* test_resolve_resolved_promise() {
|
|
let def = PromiseUtils.defer();
|
|
let expected = "Yeah resolved" + Math.random();
|
|
let p = new Promise((resolve, reject) => resolve(expected));
|
|
def.resolve(p);
|
|
let result = yield def.promise;
|
|
Assert.equal(result, expected, "Resolved promise is passed to the resolve method");
|
|
});
|
|
|
|
/* Test for the case when a rejected promise is
|
|
* passed to the resolve method */
|
|
add_task(function* test_resolve_rejected_promise() {
|
|
let def = PromiseUtils.defer();
|
|
let p = new Promise((resolve, reject) => reject(new Error("There its an rejection")));
|
|
def.resolve(p);
|
|
yield Assert.rejects(def.promise, /There its an rejection/, "Settled rejection promise passed to the resolve method");
|
|
});
|
|
|
|
/* Test for the checking the reject method of
|
|
* the Deferred object returned by PromiseUtils.defer() */
|
|
add_task(function* test_reject_Error() {
|
|
let def = PromiseUtils.defer();
|
|
def.reject(new Error("This one rejects"));
|
|
yield Assert.rejects(def.promise, /This one rejects/, "reject method with Error for rejection");
|
|
});
|
|
|
|
/* Test for the case when a pending Promise is passed to
|
|
* the reject method of Deferred object */
|
|
add_task(function* test_reject_pending_promise() {
|
|
let def = PromiseUtils.defer();
|
|
let p = new Promise((resolve, reject) => {
|
|
setTimeout(() => resolve(100), 100);
|
|
});
|
|
def.reject(p);
|
|
yield Assert.rejects(def.promise, Promise, "Rejection with a pending promise uses the passed promise itself as the reason of rejection");
|
|
});
|
|
|
|
/* Test for the case when a resolved Promise
|
|
* is passed to the reject method */
|
|
add_task(function* test_reject_resolved_promise() {
|
|
let def = PromiseUtils.defer();
|
|
let p = new Promise((resolve, reject) => resolve("This resolved"));
|
|
def.reject(p);
|
|
yield Assert.rejects(def.promise, Promise, "Rejection with a resolved promise uses the passed promise itself as the reason of rejection");
|
|
});
|
|
|
|
/* Test for the case when a rejected Promise is
|
|
* passed to the reject method */
|
|
add_task(function* test_reject_resolved_promise() {
|
|
PromiseTestUtils.expectUncaughtRejection(/This one rejects/);
|
|
let def = PromiseUtils.defer();
|
|
let p = new Promise((resolve, reject) => reject(new Error("This one rejects")));
|
|
def.reject(p);
|
|
yield Assert.rejects(def.promise, Promise, "Rejection with a rejected promise uses the passed promise itself as the reason of rejection");
|
|
});
|