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

Side by Side Diff: Tools/GardeningServer/model/test/tree-status-tests.html

Issue 536163002: Teach the network simulator to wait for Promises. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 <!-- 1 <!--
2 Copyright 2014 The Chromium Authors. All rights reserved. 2 Copyright 2014 The Chromium Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style license that can be 3 Use of this source code is governed by a BSD-style license that can be
4 found in the LICENSE file. 4 found in the LICENSE file.
5 --> 5 -->
6 6
7 <link rel="import" href="../tree-status.html"> 7 <link rel="import" href="../tree-status.html">
8 8
9 <link rel="import" href="../../lib/network-simulator.html"> 9 <link rel="import" href="../../lib/network-simulator.html">
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 simulator.json = function(url) { 46 simulator.json = function(url) {
47 if (url.indexOf('closed') != -1) 47 if (url.indexOf('closed') != -1)
48 return Promise.resolve(closedTreeJson); 48 return Promise.resolve(closedTreeJson);
49 else if (url.indexOf('throttled') != -1) 49 else if (url.indexOf('throttled') != -1)
50 return Promise.resolve(throttledTreeJson); 50 return Promise.resolve(throttledTreeJson);
51 else 51 else
52 return Promise.resolve(openTreeJson); 52 return Promise.resolve(openTreeJson);
53 }; 53 };
54 54
55 simulator.runTest(function() { 55 simulator.runTest(function() {
56 Promise.all([ 56 return Promise.all([
57 opentree.update().then(function() { 57 opentree.update().then(function() {
58 assert.equal(opentree.status, 'open'); 58 assert.equal(opentree.status, 'open');
59 }), 59 }),
60 throttledtree.update().then(function() { 60 throttledtree.update().then(function() {
61 assert.equal(throttledtree.message, 61 assert.equal(throttledtree.message,
62 "Tree is throttled just for fun by username@test.org"); 62 "Tree is throttled just for fun by username@test.org");
63 assert.equal(throttledtree.status, "throttled"); 63 assert.equal(throttledtree.status, "throttled");
64 }), 64 }),
65 closedtree.update().then(function() { 65 closedtree.update().then(function() {
66 assert.equal(closedtree.message, 66 assert.equal(closedtree.message,
67 "Tree is closed by ojan@chromium.org"); 67 "Tree is closed by ojan@chromium.org");
68 assert.equal(closedtree.status, "closed"); 68 assert.equal(closedtree.status, "closed");
69 }) 69 })
70 ]); 70 ]);
71 }).then(done); 71 });
72 }); 72 });
73 }); 73 });
74 74
75 })(); 75 })();
76 </script> 76 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698