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

Unified Diff: test/webkit/fast/js/Promise-reject.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-reject.js
diff --git a/test/webkit/dfg-inline-arguments-osr-exit-and-capture.js b/test/webkit/fast/js/Promise-reject.js
similarity index 65%
copy from test/webkit/dfg-inline-arguments-osr-exit-and-capture.js
copy to test/webkit/fast/js/Promise-reject.js
index 4d254d8e7d44fa1da6e0001534c587279210c5ee..82413d59831c644d1a5aaaad6d94437c479d28e4 100644
--- a/test/webkit/dfg-inline-arguments-osr-exit-and-capture.js
+++ b/test/webkit/fast/js/Promise-reject.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 Promise rejection.');
-function foo() {
- return bar.arguments[0];
-}
+var reject;
+var promise = new Promise(function(_, r) { reject = 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);
-}
+reject('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() {
+ testFailed('fulfilled.');
+ finishJSTest();
+}, function() {
+ shouldBeEqualToString('promiseState', 'rejected');
+ shouldBeEqualToString('promiseResult', 'hello');
+ finishJSTest();
+});
« no previous file with comments | « test/webkit/fast/js/Promise-onRejected-deep-expected.txt ('k') | test/webkit/fast/js/Promise-reject-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698