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

Unified Diff: LayoutTests/fast/js/Promise-init.html

Issue 17505004: Introduce 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-init.html
diff --git a/LayoutTests/fast/js/Promise-init.html b/LayoutTests/fast/js/Promise-init.html
new file mode 100644
index 0000000000000000000000000000000000000000..6c52a8f902bed4ca1c0fb3fbf2b43db3d3651856
--- /dev/null
+++ b/LayoutTests/fast/js/Promise-init.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="resources/js-test-pre.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+
+description('Test Promise.');
+
+var thisInInit;
+var resolver;
+var promise = new Promise(function(r) {
+ thisInInit = this;
+ resolver = r;
+});
+
+shouldBeTrue('promise instanceof Promise');
+shouldBe('promise.constructor', 'Promise');
+shouldBe('thisInInit', 'promise');
+shouldBeTrue('resolver instanceof PromiseResolver');
+shouldBe('resolver.constructor', 'PromiseResolver');
+
+shouldThrow('new Promise()', '"TypeError: Promise constructor takes a function argument"');
+shouldThrow('new Promise(37)', '"TypeError: Promise constructor takes a function argument"');
+
+shouldNotThrow('promise = new Promise(function() { throw Error("foo"); })');
+// FIXME: We can't test if the promise is rejected now, but should test it in the future.
+
+</script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/fast/js/Promise-init-expected.txt » ('j') | Source/bindings/v8/custom/V8PromiseCustom.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698