Index: LayoutTests/fast/js/Promise-simple.html |
diff --git a/LayoutTests/fast/js/Promise-simple.html b/LayoutTests/fast/js/Promise-simple.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a8b53f82982e1d4da6ef065e2357fac7b123bf73 |
--- /dev/null |
+++ b/LayoutTests/fast/js/Promise-simple.html |
@@ -0,0 +1,36 @@ |
+<!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; |
+ |
+var resolver; |
+ |
+var firstPromise = new Promise(function(newResolver) { |
+ window.thisInInit = this; |
+ resolver = newResolver; |
+}); |
+ |
+var secondPromise = firstPromise.then(function(result) { |
+ window.thisInFulfillCallback = this; |
+ shouldBeTrue('thisInFulfillCallback === secondPromise'); |
+ window.result = result; |
+ shouldBeEqualToString('result', 'hello'); |
+ finishJSTest(); |
+}); |
+ |
+shouldBeTrue('thisInInit === firstPromise'); |
+ |
+resolver.fulfill('hello'); |
+ |
+</script> |
+<script src="resources/js-test-post.js"></script> |
+</body> |
+</html> |