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

Unified Diff: test/webkit/fast/js/Promise-resolve-chain.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
« no previous file with comments | « test/webkit/fast/js/Promise-resolve.js ('k') | test/webkit/fast/js/Promise-resolve-chain-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/webkit/fast/js/Promise-resolve-chain.js
diff --git a/test/webkit/exception-try-finally-scope-error.js b/test/webkit/fast/js/Promise-resolve-chain.js
similarity index 57%
copy from test/webkit/exception-try-finally-scope-error.js
copy to test/webkit/fast/js/Promise-resolve-chain.js
index cfb2b92b5659d6f75b5092274dc7d2b5e8a3261a..558bf53eebf731f18880ea3ee0aa88619b7012ee 100644
--- a/test/webkit/exception-try-finally-scope-error.js
+++ b/test/webkit/fast/js/Promise-resolve-chain.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,39 +21,40 @@
// (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 makes sure stack unwinding works correctly in combination with dynamically added scopes');
-
-function gc()
-{
- if (this.GCController)
- GCController.collect();
- else
- for (var i = 0; i < 10000; ++i) // Allocate a sufficient number of objects to force a GC.
- ({});
-}
+// Flags: --harmony
+'use strict';
+description('Test chained Promise resolutions.');
+var resolve1, resolve2, resolve3;
+var reject4, resolve5, resolve6;
var result;
-function runTest() {
- var test = "outer scope";
- with({test:"inner scope"})
- (function () { try { throw ""; } finally { result = test; shouldBe("result", '"inner scope"'); return;}})()
-}
-runTest();
+var promise1 = new Promise(function(r) { resolve1 = r; });
+var promise2 = new Promise(function(r) { resolve2 = r; });
+var promise3 = new Promise(function(r) { resolve3 = r; });
+var promise4 = new Promise(function(_, r) { reject4 = r; });
+var promise5 = new Promise(function(r) { resolve5 = r; });
+var promise6 = new Promise(function(r) { resolve6 = r; });
+
+resolve3(promise2);
+resolve2(promise1);
+resolve6(promise5);
+resolve5(promise4);
-try{
-(function() {
- try {
- throw "";
- } catch(y) {
- throw (function(){});
- } finally {
- }
-})()
-}catch(r){
-}
+promise3.then(function(localResult) {
+ result = localResult;
+ shouldBeEqualToString('result', 'hello');
+}, function() {
+ testFailed('rejected');
+});
-// Just clobber any temporaries
-a=({});
-a*=a*a*a;
+promise6.then(function() {
+ testFailed('fulfilled');
+ finishJSTest();
+}, function(localResult) {
+ result = localResult;
+ shouldBeEqualToString('result', 'bye');
+ finishJSTest();
+});
-gc();
+resolve1('hello');
+reject4('bye');
« no previous file with comments | « test/webkit/fast/js/Promise-resolve.js ('k') | test/webkit/fast/js/Promise-resolve-chain-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698