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

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

Issue 400423002: Remove base.* methods. (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/scripts/results.js ('k') | Tools/GardeningServer/scripts/svn-log.js » ('j') | 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 (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 ok(!analyzer.succeeded()); 146 ok(!analyzer.succeeded());
147 ok(!analyzer.flaky()); 147 ok(!analyzer.flaky());
148 148
149 analyzer = new results.ResultAnalyzer({expected: 'FAIL', actual: 'IMAGE+TEXT '}); 149 analyzer = new results.ResultAnalyzer({expected: 'FAIL', actual: 'IMAGE+TEXT '});
150 ok(!analyzer.hasUnexpectedFailures()); 150 ok(!analyzer.hasUnexpectedFailures());
151 deepEqual(analyzer.unexpectedResults(), []); 151 deepEqual(analyzer.unexpectedResults(), []);
152 ok(!analyzer.succeeded()); 152 ok(!analyzer.succeeded());
153 ok(!analyzer.flaky()); 153 ok(!analyzer.flaky());
154 }); 154 });
155 155
156 test("trimExtension", 6, function() {
157 equals(results._trimExtension("xyz"), "xyz");
158 equals(results._trimExtension("xy.z"), "xy");
159 equals(results._trimExtension("x.yz"), "x");
160 equals(results._trimExtension("x.y.z"), "x.y");
161 equals(results._trimExtension(".xyz"), "");
162 equals(results._trimExtension(""), "");
163 });
164
165 test("joinPath", 1, function() {
166 var value = results._joinPath("path/to", "test.html");
167 equals(value, "path/to/test.html");
168 });
169
170 test("joinPath with empty parent", 1, function() {
171 var value = results._joinPath("", "test.html");
172 equals(value, "test.html");
173 });
174
175 test("filterTree", 2, function() {
176 var tree = {
177 'path': {
178 'to': {
179 'test.html': {
180 'actual': 'PASS',
181 'expected': 'FAIL'
182 }
183 },
184 'another.html': {
185 'actual': 'TEXT',
186 'expected': 'PASS'
187 }
188 }
189 }
190
191 function isLeaf(node)
192 {
193 return !!node.actual;
194 }
195
196 function actualIsText(node)
197 {
198 return node.actual == 'TEXT';
199 }
200
201 var all = results._filterTree(tree, isLeaf, function() { return true });
202 deepEqual(all, {
203 'path/to/test.html': {
204 'actual': 'PASS',
205 'expected': 'FAIL'
206 },
207 'path/another.html': {
208 'actual': 'TEXT',
209 'expected': 'PASS'
210 }
211 });
212
213 var text = results._filterTree(tree, isLeaf, actualIsText);
214 deepEqual(text, {
215 'path/another.html': {
216 'actual': 'TEXT',
217 'expected': 'PASS'
218 }
219 });
220 });
221
156 test("unexpectedFailures", 1, function() { 222 test("unexpectedFailures", 1, function() {
157 var unexpectedFailures = results.unexpectedFailures(unittest.kExampleResults JSON); 223 var unexpectedFailures = results.unexpectedFailures(unittest.kExampleResults JSON);
158 deepEqual(unexpectedFailures, { 224 deepEqual(unexpectedFailures, {
159 "userscripts/another-test.html": { 225 "userscripts/another-test.html": {
160 "expected": "PASS", 226 "expected": "PASS",
161 "actual": "TEXT", 227 "actual": "TEXT",
162 "is_unexpected": true, 228 "is_unexpected": true,
163 } 229 }
164 }); 230 });
165 }); 231 });
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 }); 450 });
385 }); 451 });
386 452
387 asyncTest("fetchResultsURLs", 5, function() { 453 asyncTest("fetchResultsURLs", 5, function() {
388 var simulator = new NetworkSimulator(); 454 var simulator = new NetworkSimulator();
389 455
390 var probedURLs = []; 456 var probedURLs = [];
391 simulator.probe = function(url) 457 simulator.probe = function(url)
392 { 458 {
393 probedURLs.push(url); 459 probedURLs.push(url);
394 if (base.endsWith(url, '.txt')) 460 if (url.endsWith('.txt'))
395 return Promise.resolve(); 461 return Promise.resolve();
396 else if (/taco.+png$/.test(url)) 462 else if (/taco.+png$/.test(url))
397 return Promise.resolve(); 463 return Promise.resolve();
398 else 464 else
399 return Promise.reject(); 465 return Promise.reject();
400 }; 466 };
401 467
402 simulator.runTest(function() { 468 simulator.runTest(function() {
403 results.fetchResultsURLs({ 469 results.fetchResultsURLs({
404 'builderName': "Mock Builder", 470 'builderName': "Mock Builder",
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 }); 513 });
448 }); 514 });
449 515
450 asyncTest("fetchResultsByBuilder", 3, function() { 516 asyncTest("fetchResultsByBuilder", 3, function() {
451 var simulator = new NetworkSimulator(); 517 var simulator = new NetworkSimulator();
452 518
453 var probedURLs = []; 519 var probedURLs = [];
454 simulator.jsonp = function(url) 520 simulator.jsonp = function(url)
455 { 521 {
456 probedURLs.push(url); 522 probedURLs.push(url);
457 return Promise.resolve(base.endsWith(url, 'results/layout-test-results/f ailing_results.json')); 523 return Promise.resolve(url.endsWith('results/layout-test-results/failing _results.json'));
458 }; 524 };
459 525
460 simulator.runTest(function() { 526 simulator.runTest(function() {
461 results.fetchResultsByBuilder(['MockBuilder1', 'MockBuilder2']).then(fun ction(resultsByBuilder) { 527 results.fetchResultsByBuilder(['MockBuilder1', 'MockBuilder2']).then(fun ction(resultsByBuilder) {
462 deepEqual(resultsByBuilder, { 528 deepEqual(resultsByBuilder, {
463 "MockBuilder1": true, 529 "MockBuilder1": true,
464 "MockBuilder2": true, 530 "MockBuilder2": true,
465 }); 531 });
466 }); 532 });
467 }).then(start); 533 }).then(start);
468 534
469 deepEqual(probedURLs, [ 535 deepEqual(probedURLs, [
470 MockResultsBaseURL.replace('Mock_Builder', 'MockBuilder1') + "/failing_r esults.json", 536 MockResultsBaseURL.replace('Mock_Builder', 'MockBuilder1') + "/failing_r esults.json",
471 MockResultsBaseURL.replace('Mock_Builder', 'MockBuilder2') + "/failing_r esults.json" 537 MockResultsBaseURL.replace('Mock_Builder', 'MockBuilder2') + "/failing_r esults.json"
472 ]); 538 ]);
473 539
474 }); 540 });
475 541
476 })(); 542 })();
OLDNEW
« no previous file with comments | « Tools/GardeningServer/scripts/results.js ('k') | Tools/GardeningServer/scripts/svn-log.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698