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

Unified Diff: test/webkit/fast/js/Promise-then-callback-receiver.js

Issue 196133017: Experimental parser: merge r19949 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 9 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/webkit/array-index-immediate-types.js b/test/webkit/fast/js/Promise-then-callback-receiver.js
similarity index 65%
copy from test/webkit/array-index-immediate-types.js
copy to test/webkit/fast/js/Promise-then-callback-receiver.js
index 7bacc9d0fc2751ed6b0f943e64a9993226b10d1c..e34bdaeb5b39e4ad242beb98612ab6a804383b9a 100644
--- a/test/webkit/array-index-immediate-types.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,24 +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.
-description(
-"This test checks the behaviour of indexing an Array with immediate types."
-);
+// Flags: --harmony
+'use strict';
+description('Test whether then callback receivers are correctly set.');
-var array = ["Zero", "One"];
+var thisInOnFulfilled;
+var thisInOnRejected;
-shouldBe("array[0]", '"Zero"');
-shouldBe("array[null]", "undefined");
-shouldBe("array[undefined]", "undefined");
-shouldBe("array[true]", "undefined");
-shouldBe("array[false]", "undefined");
-
-function putSelf(array, index)
-{
- index = index << 0;
- array[index] = index;
- return true;
-}
-
-shouldBeTrue("putSelf([0], 0);");
-shouldBeTrue("putSelf([0], 1/9);");
+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