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

Side by Side Diff: Tools/GardeningServer/scripts/treestatus_unittests.js

Issue 401163002: Fix exceptions when running the tests. (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
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/curren t?format=json');
48 equal(treestatus.urlByName('chromium'), 'http://chromium-status.appspot.com/ current?format=json'); 48 equal(treestatus.urlByName('chromium'), 'http://chromium-status.appspot.com/ current?format=json');
49 equal(treestatus.urlByName('foo'), null); 49 equal(treestatus.urlByName('foo'), null);
50 }); 50 });
51 51
52 asyncTest('fetchTreeStatus', 4, 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);
59 else 59 else
60 return Promise.resolve(openTreeJson); 60 return Promise.resolve(openTreeJson);
61 }; 61 };
62 62
63 var span = document.createElement('span'); 63 var span = document.createElement('span');
64 simulator.runTest(function() { 64 simulator.runTest(function() {
65 treestatus.fetchTreeStatus('http://opentree', span) 65 treestatus.fetchTreeStatus('http://opentree', span)
66 .then(function(result) { 66 .then(function(result) {
67 equal(span.textContent, 'OPEN'); 67 equal(span.textContent, 'OPEN');
68 68
69 span = document.createElement('span'); 69 span = document.createElement('span');
70 simulator.runTest(function() { 70 treestatus.fetchTreeStatus('http://closedtree', span)
71 treestatus.fetchTreeStatus('http://closedtree', span) 71 .then(function() {
72 .then(function() { 72 equal(span.textContent, 'Tree is closed by ojan@chromium .org');
73 equal(span.textContent, 'Tree is closed by ojan@chro mium.org'); 73 start();
74 start(); 74 });
75 });
76 });
77 }); 75 });
78 }); 76 });
79 }); 77 });
80 78
81 })(); 79 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698