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..7c68e8139178b255b047f6bef2c0598dcd827e91 |
--- /dev/null |
+++ b/LayoutTests/fast/js/Promise-simple.html |
@@ -0,0 +1,39 @@ |
+<!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(value) { |
+ window.thisInFulfillCallback = this; |
+ shouldBeTrue("thisInFulfillCallback === secondPromise"); |
+ window.value = value; |
+ shouldBeEqualToString("value", "hello"); |
+ finishJSTest(); |
+ }); |
+ |
+shouldBeTrue("thisInInit === firstPromise"); |
+ |
+resolver.fulfill("hello"); |
+ |
+</script> |
+<script src="resources/js-test-post.js"></script> |
+</body> |
+</html> |