| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 var closedTreeJson = { | 38 var closedTreeJson = { |
| 39 "username": "ojan@chromium.org", | 39 "username": "ojan@chromium.org", |
| 40 "date": "2013-10-14 20:32:09.642350", | 40 "date": "2013-10-14 20:32:09.642350", |
| 41 "message": "Tree is closed", | 41 "message": "Tree is closed", |
| 42 "can_commit_freely": false, | 42 "can_commit_freely": false, |
| 43 "general_state": "closed" | 43 "general_state": "closed" |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 test('urlByName', 3, function() { | 46 test('urlByName', 3, function() { |
| 47 equal(treestatus.urlByName('blink'), 'http://blink-status.appspot.com/curren
t?format=json'); | 47 equal(treestatus.urlByName('blink'), 'http://blink-status.appspot.com/'); |
| 48 equal(treestatus.urlByName('chromium'), 'http://chromium-status.appspot.com/
current?format=json'); | 48 equal(treestatus.urlByName('chromium'), 'http://chromium-status.appspot.com/
'); |
| 49 equal(treestatus.urlByName('foo'), null); | 49 equal(treestatus.urlByName('foo'), null); |
| 50 }); | 50 }); |
| 51 | 51 |
| 52 asyncTest('fetchTreeStatus', 3, function() { | 52 asyncTest('fetchTreeStatus', 3, function() { |
| 53 var simulator = new NetworkSimulator(); | 53 var simulator = new NetworkSimulator(); |
| 54 | 54 |
| 55 simulator.json = function(url) | 55 simulator.json = function(url) |
| 56 { | 56 { |
| 57 if (url.indexOf('closed') != -1) | 57 if (url.indexOf('closed') != -1) |
| 58 return Promise.resolve(closedTreeJson); | 58 return Promise.resolve(closedTreeJson); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 70 treestatus.fetchTreeStatus('http://closedtree', span) | 70 treestatus.fetchTreeStatus('http://closedtree', span) |
| 71 .then(function() { | 71 .then(function() { |
| 72 equal(span.textContent, 'Tree is closed by ojan@chromium
.org'); | 72 equal(span.textContent, 'Tree is closed by ojan@chromium
.org'); |
| 73 start(); | 73 start(); |
| 74 }); | 74 }); |
| 75 }); | 75 }); |
| 76 }); | 76 }); |
| 77 }); | 77 }); |
| 78 | 78 |
| 79 })(); | 79 })(); |
| OLD | NEW |