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

Unified Diff: test/webkit/fast/js/Promise-then-callback-receiver.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-then-callback-receiver.js
diff --git a/test/mjsunit/regress/regress-2989.js b/test/webkit/fast/js/Promise-then-callback-receiver.js
similarity index 65%
copy from test/mjsunit/regress/regress-2989.js
copy to test/webkit/fast/js/Promise-then-callback-receiver.js
index 49c4a1cb03ba45b8938e08ab024f0b8d13a66ed6..e34bdaeb5b39e4ad242beb98612ab6a804383b9a 100644
--- a/test/mjsunit/regress/regress-2989.js
+++ b/test/webkit/fast/js/Promise-then-callback-receiver.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,15 +21,27 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --allow-natives-syntax
+// Flags: --harmony
+'use strict';
+description('Test whether then callback receivers are correctly set.');
-(function ArgumentsObjectChange() {
- function f(x) {
- x = 42;
- return f.arguments[0];
- }
+var thisInOnFulfilled;
+var thisInOnRejected;
- f(0);
- %OptimizeFunctionOnNextCall(f);
- assertEquals(42, f(0));
-})();
+Promise.resolve().then(function () {
+ return Promise.resolve(42).then(function () {
+ testPassed('fulfilled');
+ thisInOnFulfilled = this;
+ shouldBe('thisInOnFulfilled', 'undefined');
+ }, function () {
+ testFailed('rejected');
+ });
+}).then(function () {
+ return Promise.reject(42).then(function () {
+ testFailed('fulfilled');
+ }, function () {
+ testPassed('rejected');
+ thisInOnRejected = this;
+ shouldBe('thisInOnRejected', 'undefined');
+ });
+}).then(finishJSTest, finishJSTest);
« no previous file with comments | « test/webkit/fast/js/Promise-then.js ('k') | test/webkit/fast/js/Promise-then-callback-receiver-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698