| Index: Tools/GardeningServer/model/tree-status-tests.html
|
| diff --git a/Tools/GardeningServer/ui/ct-tree-status-tests.html b/Tools/GardeningServer/model/tree-status-tests.html
|
| similarity index 50%
|
| copy from Tools/GardeningServer/ui/ct-tree-status-tests.html
|
| copy to Tools/GardeningServer/model/tree-status-tests.html
|
| index f14e34a99b590f9d0f06d93606a065d5c23e0a68..7d5aa968dbfc4306361e1b855b01c42c94234451 100644
|
| --- a/Tools/GardeningServer/ui/ct-tree-status-tests.html
|
| +++ b/Tools/GardeningServer/model/tree-status-tests.html
|
| @@ -4,32 +4,45 @@ Use of this source code is governed by a BSD-style license that can be
|
| found in the LICENSE file.
|
| -->
|
|
|
| -<link rel="import" href="ct-tree-status.html">
|
| +<link rel="import" href="tree-status.html">
|
|
|
| <script>
|
| +
|
| (function () {
|
|
|
| -module("ct-tree-status");
|
| +module("tree-status");
|
|
|
| -openTreeJson = {
|
| - "username": "username@test.org",
|
| +var openTreeJson = {
|
| + "username": "erg@chromium.org",
|
| + "date": "2013-10-14 20:22:00.887390",
|
| "message": "Tree is open",
|
| - "can_commit_freely": true
|
| -}
|
| + "can_commit_freely": true,
|
| + "general_state": "open"
|
| +};
|
|
|
| -throttledTreeJson = {
|
| +var throttledTreeJson = {
|
| "username": "username@test.org",
|
| + "date": "2013-10-14 20:22:00.887390",
|
| "message": "Tree is throttled just for fun",
|
| "can_commit_freely": false
|
| -}
|
| +};
|
|
|
| -closedTreeJson = {
|
| - "username": "username@test.org",
|
| - "message": "Tree is closed for maintenance",
|
| - "can_commit_freely": false
|
| -}
|
| +var closedTreeJson = {
|
| + "username": "ojan@chromium.org",
|
| + "date": "2013-10-14 20:32:09.642350",
|
| + "message": "Tree is closed",
|
| + "can_commit_freely": false,
|
| + "general_state": "closed"
|
| +};
|
| +
|
| +test('url', 3, function() {
|
| + var treeStatus = new TreeStatus('blink');
|
| + equal(new TreeStatus('blink').url(), 'http://blink-status.appspot.com/');
|
| + equal(new TreeStatus('chromium').url(), 'http://chromium-status.appspot.com/');
|
| + equal(new TreeStatus('foo').url(), null);
|
| +});
|
|
|
| -asyncTest("basic", 10, function() {
|
| +asyncTest("basic", 6, function() {
|
| var simulator = new NetworkSimulator();
|
| simulator.json = function(url) {
|
| if (url.indexOf('closed') != -1)
|
| @@ -40,17 +53,14 @@ asyncTest("basic", 10, function() {
|
| return Promise.resolve(openTreeJson);
|
| };
|
|
|
| - var opentree = document.createElement("ct-tree-status");
|
| - opentree.project = "open-tree-project";
|
| - var throttledtree = document.createElement("ct-tree-status");
|
| - throttledtree.project = "throttled-tree-project";
|
| - var closedtree = document.createElement("ct-tree-status");
|
| - closedtree.project = "closed-tree-project";
|
| + var opentree = new TreeStatus("open-tree-project");
|
| + var throttledtree = new TreeStatus("throttled-tree-project");
|
| + var closedtree = new TreeStatus("closed-tree-project");
|
|
|
| simulator.runTest(function() {
|
| - var urlByName = treestatus.urlByName;
|
| - treestatus.urlByName = function(name) {
|
| - return "http://" + name + "-status.appspot.com/";
|
| + var url = TreeStatus.prototype.url;
|
| + TreeStatus.prototype.url = function() {
|
| + return "http://" + this.project + "-status.appspot.com/";
|
| }
|
| Promise.all([
|
| opentree.update().then(function() {
|
| @@ -63,17 +73,13 @@ asyncTest("basic", 10, function() {
|
| }),
|
| closedtree.update().then(function() {
|
| equal(closedtree.message,
|
| - "Tree is closed for maintenance by username@test.org");
|
| + "Tree is closed by ojan@chromium.org");
|
| equal(closedtree.status, "closed");
|
| - equal(closedtree.shadowRoot.querySelector('a').href, treestatus.urlByName('closed-tree-project'));
|
| })
|
| ]).then(function() {
|
| requestAnimationFrame(function() {
|
| - ok(!opentree.shadowRoot.textContent.has("open-tree-project"));
|
| - ok(throttledtree.shadowRoot.textContent.has("throttled-tree-project"));
|
| - ok(closedtree.shadowRoot.textContent.has("closed-tree-project"));
|
| start();
|
| - treestatus.urlByName = urlByName;
|
| + TreeStatus.prototype.url = url;
|
| });
|
| });
|
| });
|
|
|