Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Unified Diff: LayoutTests/fast/js/Promise-static-any.html

Issue 16838012: [ABANDONED] Implement Promises. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/js/Promise-static-any.html
diff --git a/LayoutTests/fast/js/Promise-static-any.html b/LayoutTests/fast/js/Promise-static-any.html
new file mode 100644
index 0000000000000000000000000000000000000000..e6fb83167d97021bd5e6a70d31010a8be84b69f0
--- /dev/null
+++ b/LayoutTests/fast/js/Promise-static-any.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="resources/js-test-pre.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+description('Test Promise.');
+
+window.jsTestIsAsync = true;
+result = undefined;
+
+var p1 = Promise.fulfill('p1');
+var p2 = Promise.fulfill('p2');
+var p3 = Promise.fulfill('p3');
+var p4 = new Promise(function(){});
+var p5 = new Promise(function(){});
+var p6 = Promise.reject('p6');
+var p7 = Promise.reject('p7');
+var p8 = Promise.resolve('p7');
+
+var pp0 = Promise.any().then(function (result) {
+ debug('PASS Promise.any() is fulfilled.');
+ window.result = result;
+ shouldBe('result', 'undefined');
+}, function() {
+ debug('FAIL Promise.any() is rejected.');
+});
+
+var pp1 = Promise.any(p4, p1, p6).then(function (result) {
+ debug('PASS Promise.any(p4, p1, p6) is fulfilled.');
+ window.result = result;
+ shouldBeEqualToString('result', 'p1');
+}, function () {
+ debug('FAIL Promise.any(p4, p1, p6) is rejected.');
+});
+
+var pp2 = Promise.any(p4, p5).then(function (result) {
+ debug('FAIL Promise.any(p4, p5) is fulfilled.');
+}, function () {
+ debug('FAIL Promise.any(p4, p5) is rejected.');
+});
+
+var pp3 = Promise.any(p4, p6, p1).then(function (result) {
+ debug('FAIL Promise.any(p4, p6, p1) is fulfilled.');
+}, function (result) {
+ debug('PASS Promise.any(p4, p6, p1) is rejected.');
+ window.result = result;
+ shouldBeEqualToString('result', 'p6');
+});
+
+shouldBe("result", "undefined");
+Promise.every(pp0, pp1, pp3).then(finishJSTest, finishJSTest);
+
+</script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698