Index: test/webkit/fast/js/Promise-resolve-state.js |
diff --git a/test/webkit/dfg-inline-arguments-osr-exit-and-capture.js b/test/webkit/fast/js/Promise-resolve-state.js |
similarity index 63% |
copy from test/webkit/dfg-inline-arguments-osr-exit-and-capture.js |
copy to test/webkit/fast/js/Promise-resolve-state.js |
index 4d254d8e7d44fa1da6e0001534c587279210c5ee..165d1149b8abad2d9d4a3a3e78dc480c058bb3b5 100644 |
--- a/test/webkit/dfg-inline-arguments-osr-exit-and-capture.js |
+++ b/test/webkit/fast/js/Promise-resolve-state.js |
@@ -1,4 +1,4 @@ |
-// Copyright 2013 the V8 project authors. All rights reserved. |
+// Copyright 2014 the V8 project authors. All rights reserved. |
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
// |
// Redistribution and use in source and binary forms, with or without |
@@ -21,35 +21,33 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-description( |
-"Tests what happens if you OSR exit within inlined code that has interesting control flow with arguments that are specially formatted and you capture the arguments reflectively after the OSR exit." |
-); |
+// Flags: --harmony |
+'use strict'; |
+description('Test whether Promise processes microtasks in the correct order.'); |
-function foo() { |
- return bar.arguments[0]; |
-} |
+var resolve; |
+var promise = new Promise(function(r) { resolve = r; }); |
+var promiseState = 'pending'; |
+var promiseResult = undefined; |
+promise.then(function(result) { |
+ promiseState = 'fulfilled'; |
+ promiseResult = result; |
+}, function(result) { |
+ promiseState = 'rejected'; |
+ promiseResult = result; |
+}); |
-function bar(x, y) { |
- if (x + 5 > 4) |
- return y.f + 42 + foo(); |
- else |
- return y.f + 43 + foo(); |
-} |
+shouldBeEqualToString('promiseState', 'pending'); |
-function baz(x, y) { |
- return bar(x, y); |
-} |
+resolve('hello'); |
-for (var i = 0; i < 300; ++i) { |
- var expected; |
- var arg1 = i; |
- var arg2; |
- if (i < 250) { |
- arg2 = {f:i + 1}; |
- expected = i + 1 + 42 + i; |
- } else { |
- arg2 = {f:1.5}; |
- expected = 1.5 + 42 + i; |
- } |
- shouldBe("baz(arg1, arg2)", "" + expected); |
-} |
+shouldBeEqualToString('promiseState', 'pending'); |
+ |
+promise.then(function() { |
+ shouldBeEqualToString('promiseState', 'fulfilled'); |
+ shouldBeEqualToString('promiseResult', 'hello'); |
+ finishJSTest(); |
+}, function() { |
+ testFailed('promise is rejected.'); |
+ finishJSTest(); |
+}); |