Index: LayoutTests/fast/js/Promise-resolve-with-itself.html |
diff --git a/LayoutTests/fast/js/Promise-already-rejected.html b/LayoutTests/fast/js/Promise-resolve-with-itself.html |
similarity index 50% |
copy from LayoutTests/fast/js/Promise-already-rejected.html |
copy to LayoutTests/fast/js/Promise-resolve-with-itself.html |
index 52697b5d6b8056f3f99595684f75e3eb5abd46b3..630021ccaba2b90526b87a318f2bb3c760b2cebb 100644 |
--- a/LayoutTests/fast/js/Promise-already-rejected.html |
+++ b/LayoutTests/fast/js/Promise-resolve-with-itself.html |
@@ -11,18 +11,18 @@ description('Test Promise.'); |
window.jsTestIsAsync = true; |
-new Promise(function(resolve, reject) { |
- reject('foo'); |
- resolve('resolve'); |
- reject('reject'); |
-}).then(function() { |
+var resolve; |
+var promise = new Promise(function(r) { resolve = r; }); |
+ |
+promise.then(function () { |
testFailed('fulfilled'); |
- finishJSTest(); |
-}, function(result) { |
- window.result = result; |
- shouldBeEqualToString('result', 'foo'); |
- finishJSTest(); |
-}); |
+}, function (error) { |
+ testPassed('rejected'); |
+ window.result = error.toString(); |
+ shouldBeEqualToString('result', 'TypeError: Resolve a promise with itself'); |
+}).then(finishJSTest, finishJSTest); |
+ |
+resolve(promise); |
</script> |
<script src="resources/js-test-post.js"></script> |