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

Side by Side Diff: Tools/GardeningServer/ui/ct-tree-status-tests.html

Issue 398653005: Add a details link to ct-tree-status. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Tools/GardeningServer/ui/ct-tree-status.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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="ct-tree-status.html"> 7 <link rel="import" href="ct-tree-status.html">
8 8
9 <script> 9 <script>
10 (function () { 10 (function () {
(...skipping 11 matching lines...) Expand all
22 "message": "Tree is throttled just for fun", 22 "message": "Tree is throttled just for fun",
23 "can_commit_freely": false 23 "can_commit_freely": false
24 } 24 }
25 25
26 closedTreeJson = { 26 closedTreeJson = {
27 "username": "username@test.org", 27 "username": "username@test.org",
28 "message": "Tree is closed for maintenance", 28 "message": "Tree is closed for maintenance",
29 "can_commit_freely": false 29 "can_commit_freely": false
30 } 30 }
31 31
32 asyncTest("basic", 9, function() { 32 asyncTest("basic", 10, function() {
33 var simulator = new NetworkSimulator(); 33 var simulator = new NetworkSimulator();
34 simulator.json = function(url) { 34 simulator.json = function(url) {
35 if (url.indexOf('closed') != -1) 35 if (url.indexOf('closed') != -1)
36 return Promise.resolve(closedTreeJson); 36 return Promise.resolve(closedTreeJson);
37 else if (url.indexOf('throttled') != -1) 37 else if (url.indexOf('throttled') != -1)
38 return Promise.resolve(throttledTreeJson); 38 return Promise.resolve(throttledTreeJson);
39 else 39 else
40 return Promise.resolve(openTreeJson); 40 return Promise.resolve(openTreeJson);
41 }; 41 };
42 42
43 var opentree = document.createElement("ct-tree-status"); 43 var opentree = document.createElement("ct-tree-status");
44 opentree.project = "open-tree-project"; 44 opentree.project = "open-tree-project";
45 var throttledtree = document.createElement("ct-tree-status"); 45 var throttledtree = document.createElement("ct-tree-status");
46 throttledtree.project = "throttled-tree-project"; 46 throttledtree.project = "throttled-tree-project";
47 var closedtree = document.createElement("ct-tree-status"); 47 var closedtree = document.createElement("ct-tree-status");
48 closedtree.project = "closed-tree-project"; 48 closedtree.project = "closed-tree-project";
49 49
50 simulator.runTest(function() { 50 simulator.runTest(function() {
51 var urlByName = treestatus.urlByName; 51 var urlByName = treestatus.urlByName;
52 treestatus.urlByName = function(name) { 52 treestatus.urlByName = function(name) {
53 return name + "-status.appspot.com/current?format=json"; 53 return "http://" + name + "-status.appspot.com/";
54 } 54 }
55 Promise.all([ 55 Promise.all([
56 opentree.update().then(function() { 56 opentree.update().then(function() {
57 equal(opentree.status, "open"); 57 equal(opentree.status, "open");
58 }), 58 }),
59 throttledtree.update().then(function() { 59 throttledtree.update().then(function() {
60 equal(throttledtree.message, 60 equal(throttledtree.message,
61 "Tree is throttled just for fun by username@test.org"); 61 "Tree is throttled just for fun by username@test.org");
62 equal(throttledtree.status, "throttled"); 62 equal(throttledtree.status, "throttled");
63 }), 63 }),
64 closedtree.update().then(function() { 64 closedtree.update().then(function() {
65 equal(closedtree.message, 65 equal(closedtree.message,
66 "Tree is closed for maintenance by username@test.org"); 66 "Tree is closed for maintenance by username@test.org");
67 equal(closedtree.status, "closed"); 67 equal(closedtree.status, "closed");
68 equal(closedtree.shadowRoot.querySelector('a').href, treestatus.urlByNam e('closed-tree-project'));
68 }) 69 })
69 ]).then(function() { 70 ]).then(function() {
70 requestAnimationFrame(function() { 71 requestAnimationFrame(function() {
71 ok(!opentree.shadowRoot.textContent.trim()); 72 ok(!opentree.shadowRoot.textContent.trim());
72 ok(throttledtree.shadowRoot.textContent.has("throttled-tree-project")); 73 ok(throttledtree.shadowRoot.textContent.has("throttled-tree-project"));
73 ok(closedtree.shadowRoot.textContent.has("closed-tree-project")); 74 ok(closedtree.shadowRoot.textContent.has("closed-tree-project"));
74 start(); 75 start();
75 treestatus.urlByName = urlByName; 76 treestatus.urlByName = urlByName;
76 }); 77 });
77 }); 78 });
78 }); 79 });
79 }); 80 });
80 81
81 })(); 82 })();
82 </script> 83 </script>
OLDNEW
« no previous file with comments | « Tools/GardeningServer/ui/ct-tree-status.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698