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

Unified Diff: test/webkit/fast/js/Promise-resolve-with-then-exception.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-with-then-exception.js
diff --git a/test/webkit/dfg-intrinsic-osr-exit.js b/test/webkit/fast/js/Promise-resolve-with-then-exception.js
similarity index 74%
copy from test/webkit/dfg-intrinsic-osr-exit.js
copy to test/webkit/fast/js/Promise-resolve-with-then-exception.js
index 4ac756c310f3de11b37ef554399c35a764af8cd9..2604cb6e381a8c6143c6c9fdf738b5278c943ce7 100644
--- a/test/webkit/dfg-intrinsic-osr-exit.js
+++ b/test/webkit/fast/js/Promise-resolve-with-then-exception.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,20 +21,23 @@
// (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(
-"This tests that an OSR exit inside of an intrinsic that was not loaded with a method check works correctly."
-);
+// Flags: --harmony
+'use strict';
+description('Test whether Promise treats thenable correctly.');
-function foo(a,b) {
- return a[0](b.f);
-}
+var callback;
+var result;
-for (var i = 0; i < 100; ++i)
- foo([Math.abs], {f:5});
+new Promise(function(resolve) {
+ resolve({then: function() { throw 'hello'; }});
+}).then(function() {
+ testFailed('fulfilled');
+ finishJSTest();
+}, function(localResult) {
+ testPassed('rejected');
+ result = localResult
+ shouldBeEqualToString('result', 'hello');
+ finishJSTest();
+});
-shouldBe("foo([Math.abs], {f:5})", "5");
-
-for (var i = 0; i < 10; ++i)
- shouldBe("foo([Math.abs], {f:5.5})", "5.5");
-
-var successfullyParsed = true;
+debug('The promise is already rejected now.');

Powered by Google App Engine
This is Rietveld 408576698