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

Unified Diff: test/webkit/fast/js/Promise-resolve-state.js

Issue 182713002: Import Blink layout tests for Promises. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 6 years, 10 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: 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();
+});
« no previous file with comments | « test/webkit/fast/js/Promise-resolve-expected.txt ('k') | test/webkit/fast/js/Promise-resolve-state-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698