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

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

Issue 173133003: Convert garden-o-matic guts over to promises where appropriate (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: update to ToT Created 6 years, 10 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/rollbot.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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 '<Prefix>Another_Builder/22201/</Prefix>' + 359 '<Prefix>Another_Builder/22201/</Prefix>' +
360 '<Prefix>Another_Builder/22202/</Prefix>' + 360 '<Prefix>Another_Builder/22202/</Prefix>' +
361 '</ListBucketResult>'); 361 '</ListBucketResult>');
362 else { 362 else {
363 ok(false, 'Unexpected URL: ' + url); 363 ok(false, 'Unexpected URL: ' + url);
364 return Promise.reject('Unexpected URL: ' + url); 364 return Promise.reject('Unexpected URL: ' + url);
365 } 365 }
366 }; 366 };
367 367
368 simulator.runTest(function() { 368 simulator.runTest(function() {
369 results.regressionRangeForFailure("Mock Builder", "userscripts/another-t est.html", function(oldestFailingRevision, newestPassingRevision) { 369 results.regressionRangeForFailure("Mock Builder", "userscripts/anoth er-test.html")
370 equals(oldestFailingRevision, 90426); 370 .then(function(result) {
371 equals(newestPassingRevision, 90424); 371 var oldestFailingRevision = result[0];
372 }); 372 var newestPassingRevision = result[1];
373 373 equals(oldestFailingRevision, 90426);
374 results.unifyRegressionRanges(["Mock Builder", "Another Builder"], "user scripts/another-test.html", function(oldestFailingRevision, newestPassingRevisio n) { 374 equals(newestPassingRevision, 90424);
375 equals(oldestFailingRevision, 90426); 375 });
376 equals(newestPassingRevision, 90425); 376 results.unifyRegressionRanges(["Mock Builder", "Another Builder"], " userscripts/another-test.html")
377 }); 377 .then(function(result) {
378 var oldestFailingRevision = result[0];
379 var newestPassingRevision = result[1];
380 equals(oldestFailingRevision, 90426);
381 equals(newestPassingRevision, 90425);
382 });
378 }).then(start); 383 }).then(start);
379 }); 384 });
380 385
381 asyncTest("walkHistory (no revision)", 3, function() { 386 asyncTest("walkHistory (no revision)", 3, function() {
382 var simulator = new NetworkSimulator(); 387 var simulator = new NetworkSimulator();
383 388
384 var keyMap = { 389 var keyMap = {
385 "Mock_Builder": { 390 "Mock_Builder": {
386 "11103": { 391 "11103": {
387 "tests": { 392 "tests": {
(...skipping 21 matching lines...) Expand all
409 414
410 simulator.xml = function(url) { 415 simulator.xml = function(url) {
411 return Promise.resolve('<a href="11101/"></a><a href="11102/"></a><a hre f="11103/"></a>'); 416 return Promise.resolve('<a href="11101/"></a><a href="11102/"></a><a hre f="11103/"></a>');
412 }; 417 };
413 418
414 simulator.json = function(url) { 419 simulator.json = function(url) {
415 return Promise.resolve({}); 420 return Promise.resolve({});
416 }; 421 };
417 422
418 simulator.runTest(function() { 423 simulator.runTest(function() {
419 results.regressionRangeForFailure("Mock Builder", "userscripts/another-t est.html", function(oldestFailingRevision, newestPassingRevision) { 424 results.regressionRangeForFailure("Mock Builder", "userscripts/another-t est.html").then(function(result) {
425 var oldestFailingRevision = result[0];
426 var newestPassingRevision = result[1];
420 equals(oldestFailingRevision, 0); 427 equals(oldestFailingRevision, 0);
421 equals(newestPassingRevision, 0); 428 equals(newestPassingRevision, 0);
422 }); 429 }).then(start);
423 }).then(start); 430 });
424 }); 431 });
425 432
426 test("collectUnexpectedResults", 1, function() { 433 test("collectUnexpectedResults", 1, function() {
427 var dictionaryOfResultNodes = { 434 var dictionaryOfResultNodes = {
428 "foo": { 435 "foo": {
429 "expected": "IMAGE", 436 "expected": "IMAGE",
430 "actual": "IMAGE" 437 "actual": "IMAGE"
431 }, 438 },
432 "bar": { 439 "bar": {
433 "expected": "PASS", 440 "expected": "PASS",
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 return Promise.resolve(); 479 return Promise.resolve();
473 else 480 else
474 return Promise.reject(); 481 return Promise.reject();
475 }; 482 };
476 483
477 simulator.runTest(function() { 484 simulator.runTest(function() {
478 results.fetchResultsURLs({ 485 results.fetchResultsURLs({
479 'builderName': "Mock Builder", 486 'builderName': "Mock Builder",
480 'testName': "userscripts/another-test.html", 487 'testName': "userscripts/another-test.html",
481 'failureTypeList': ['IMAGE', 'CRASH'], 488 'failureTypeList': ['IMAGE', 'CRASH'],
482 }, function(resultURLs) { 489 }).then(function(resultURLs) {
483 deepEqual(resultURLs, [ 490 deepEqual(resultURLs, [
484 MockResultsBaseURL + "/userscripts/another-test-crash-log.txt" 491 MockResultsBaseURL + "/userscripts/another-test-crash-log.txt"
485 ]); 492 ]);
486 }); 493 });
487 results.fetchResultsURLs({ 494 results.fetchResultsURLs({
488 'builderName': "Mock Builder", 495 'builderName': "Mock Builder",
489 'testName': "userscripts/another-test.html", 496 'testName': "userscripts/another-test.html",
490 'failureTypeList': ['TIMEOUT'], 497 'failureTypeList': ['TIMEOUT'],
491 }, function(resultURLs) { 498 }).then(function(resultURLs) {
492 deepEqual(resultURLs, []); 499 deepEqual(resultURLs, []);
493 }); 500 });
494 results.fetchResultsURLs({ 501 results.fetchResultsURLs({
495 'builderName': "Mock Builder", 502 'builderName': "Mock Builder",
496 'testName': "userscripts/taco.html", 503 'testName': "userscripts/taco.html",
497 'failureTypeList': ['IMAGE', 'IMAGE+TEXT'], 504 'failureTypeList': ['IMAGE', 'IMAGE+TEXT'],
498 }, function(resultURLs) { 505 }).then(function(resultURLs) {
499 deepEqual(resultURLs, [ 506 deepEqual(resultURLs, [
500 MockResultsBaseURL + "/userscripts/taco-expected.png", 507 MockResultsBaseURL + "/userscripts/taco-expected.png",
501 MockResultsBaseURL + "/userscripts/taco-actual.png", 508 MockResultsBaseURL + "/userscripts/taco-actual.png",
502 MockResultsBaseURL + "/userscripts/taco-diff.png", 509 MockResultsBaseURL + "/userscripts/taco-diff.png",
503 MockResultsBaseURL + "/userscripts/taco-expected.txt", 510 MockResultsBaseURL + "/userscripts/taco-expected.txt",
504 MockResultsBaseURL + "/userscripts/taco-actual.txt", 511 MockResultsBaseURL + "/userscripts/taco-actual.txt",
505 MockResultsBaseURL + "/userscripts/taco-diff.txt", 512 MockResultsBaseURL + "/userscripts/taco-diff.txt",
506 ]); 513 ]);
507 }); 514 });
508 }).then(function() { 515 }).then(function() {
(...skipping 17 matching lines...) Expand all
526 var simulator = new NetworkSimulator(); 533 var simulator = new NetworkSimulator();
527 534
528 var probedURLs = []; 535 var probedURLs = [];
529 simulator.jsonp = function(url) 536 simulator.jsonp = function(url)
530 { 537 {
531 probedURLs.push(url); 538 probedURLs.push(url);
532 return Promise.resolve(base.endsWith(url, 'results/layout-test-results/f ailing_results.json')); 539 return Promise.resolve(base.endsWith(url, 'results/layout-test-results/f ailing_results.json'));
533 }; 540 };
534 541
535 simulator.runTest(function() { 542 simulator.runTest(function() {
536 results.fetchResultsByBuilder(['MockBuilder1', 'MockBuilder2'], function (resultsByBuilder) { 543 results.fetchResultsByBuilder(['MockBuilder1', 'MockBuilder2']).then(fun ction(resultsByBuilder) {
537 deepEqual(resultsByBuilder, { 544 deepEqual(resultsByBuilder, {
538 "MockBuilder1": true, 545 "MockBuilder1": true,
539 "MockBuilder2": true, 546 "MockBuilder2": true,
540 }); 547 });
541 }); 548 });
542 }).then(start); 549 }).then(start);
543 550
544 deepEqual(probedURLs, [ 551 deepEqual(probedURLs, [
545 MockResultsBaseURL.replace('Mock_Builder', 'MockBuilder1') + "/failing_r esults.json", 552 MockResultsBaseURL.replace('Mock_Builder', 'MockBuilder1') + "/failing_r esults.json",
546 MockResultsBaseURL.replace('Mock_Builder', 'MockBuilder2') + "/failing_r esults.json" 553 MockResultsBaseURL.replace('Mock_Builder', 'MockBuilder2') + "/failing_r esults.json"
547 ]); 554 ]);
548 555
549 }); 556 });
550 557
551 })(); 558 })();
OLDNEW
« no previous file with comments | « Tools/GardeningServer/scripts/results.js ('k') | Tools/GardeningServer/scripts/rollbot.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698