| OLD | NEW |
| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 181 |
| 182 test("failureInfo", 1, function() { | 182 test("failureInfo", 1, function() { |
| 183 var failureInfo = results.failureInfo("userscripts/another-test.html", "Mock
Builder", "FAIL PASS"); | 183 var failureInfo = results.failureInfo("userscripts/another-test.html", "Mock
Builder", "FAIL PASS"); |
| 184 deepEqual(failureInfo, { | 184 deepEqual(failureInfo, { |
| 185 "testName": "userscripts/another-test.html", | 185 "testName": "userscripts/another-test.html", |
| 186 "builderName": "Mock Builder", | 186 "builderName": "Mock Builder", |
| 187 "failureTypeList": ["FAIL", "PASS"], | 187 "failureTypeList": ["FAIL", "PASS"], |
| 188 }); | 188 }); |
| 189 }); | 189 }); |
| 190 | 190 |
| 191 test("failureInfoForTestAndBuilder", 1, function() { | |
| 192 var unexpectedFailuresByTest = results.unexpectedFailuresByTest({ | |
| 193 "Mock Builder": unittest.kExampleResultsJSON | |
| 194 }); | |
| 195 var failureInfo = results.failureInfoForTestAndBuilder(unexpectedFailuresByT
est, "userscripts/another-test.html", "Mock Builder"); | |
| 196 deepEqual(failureInfo, { | |
| 197 "testName": "userscripts/another-test.html", | |
| 198 "builderName": "Mock Builder", | |
| 199 "failureTypeList": ["TEXT"], | |
| 200 }); | |
| 201 }); | |
| 202 | |
| 203 test("resultKind", 12, function() { | 191 test("resultKind", 12, function() { |
| 204 equals(results.resultKind("http://example.com/foo-actual.txt"), "actual"); | 192 equals(results.resultKind("http://example.com/foo-actual.txt"), "actual"); |
| 205 equals(results.resultKind("http://example.com/foo-expected.txt"), "expected"
); | 193 equals(results.resultKind("http://example.com/foo-expected.txt"), "expected"
); |
| 206 equals(results.resultKind("http://example.com/foo-diff.txt"), "diff"); | 194 equals(results.resultKind("http://example.com/foo-diff.txt"), "diff"); |
| 207 equals(results.resultKind("http://example.com/foo.bar-actual.txt"), "actual"
); | 195 equals(results.resultKind("http://example.com/foo.bar-actual.txt"), "actual"
); |
| 208 equals(results.resultKind("http://example.com/foo.bar-expected.txt"), "expec
ted"); | 196 equals(results.resultKind("http://example.com/foo.bar-expected.txt"), "expec
ted"); |
| 209 equals(results.resultKind("http://example.com/foo.bar-diff.txt"), "diff"); | 197 equals(results.resultKind("http://example.com/foo.bar-diff.txt"), "diff"); |
| 210 equals(results.resultKind("http://example.com/foo-actual.png"), "actual"); | 198 equals(results.resultKind("http://example.com/foo-actual.png"), "actual"); |
| 211 equals(results.resultKind("http://example.com/foo-expected.png"), "expected"
); | 199 equals(results.resultKind("http://example.com/foo-expected.png"), "expected"
); |
| 212 equals(results.resultKind("http://example.com/foo-diff.png"), "diff"); | 200 equals(results.resultKind("http://example.com/foo-diff.png"), "diff"); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 simulator.runTest(function() { | 377 simulator.runTest(function() { |
| 390 results.regressionRangeForFailure("Mock Builder", "userscripts/another-t
est.html").then(function(result) { | 378 results.regressionRangeForFailure("Mock Builder", "userscripts/another-t
est.html").then(function(result) { |
| 391 var oldestFailingRevision = result[0]; | 379 var oldestFailingRevision = result[0]; |
| 392 var newestPassingRevision = result[1]; | 380 var newestPassingRevision = result[1]; |
| 393 equals(oldestFailingRevision, 0); | 381 equals(oldestFailingRevision, 0); |
| 394 equals(newestPassingRevision, 0); | 382 equals(newestPassingRevision, 0); |
| 395 }).then(start); | 383 }).then(start); |
| 396 }); | 384 }); |
| 397 }); | 385 }); |
| 398 | 386 |
| 399 test("collectUnexpectedResults", 1, function() { | |
| 400 var dictionaryOfResultNodes = { | |
| 401 "foo": { | |
| 402 "expected": "IMAGE", | |
| 403 "actual": "IMAGE" | |
| 404 }, | |
| 405 "bar": { | |
| 406 "expected": "PASS", | |
| 407 "actual": "PASS TEXT" | |
| 408 }, | |
| 409 "baz": { | |
| 410 "expected": "TEXT", | |
| 411 "actual": "IMAGE" | |
| 412 }, | |
| 413 "qux": { | |
| 414 "expected": "PASS", | |
| 415 "actual": "TEXT" | |
| 416 }, | |
| 417 "taco": { | |
| 418 "expected": "PASS", | |
| 419 "actual": "TEXT" | |
| 420 }, | |
| 421 }; | |
| 422 | |
| 423 var collectedResults = results.collectUnexpectedResults(dictionaryOfResultNo
des); | |
| 424 deepEqual(collectedResults, ["TEXT", "IMAGE"]); | |
| 425 }); | |
| 426 | |
| 427 asyncTest("fetchResultsURLs", 5, function() { | 387 asyncTest("fetchResultsURLs", 5, function() { |
| 428 var simulator = new NetworkSimulator(); | 388 var simulator = new NetworkSimulator(); |
| 429 | 389 |
| 430 var probedURLs = []; | 390 var probedURLs = []; |
| 431 simulator.probe = function(url) | 391 simulator.probe = function(url) |
| 432 { | 392 { |
| 433 probedURLs.push(url); | 393 probedURLs.push(url); |
| 434 if (base.endsWith(url, '.txt')) | 394 if (base.endsWith(url, '.txt')) |
| 435 return Promise.resolve(); | 395 return Promise.resolve(); |
| 436 else if (/taco.+png$/.test(url)) | 396 else if (/taco.+png$/.test(url)) |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 }).then(start); | 467 }).then(start); |
| 508 | 468 |
| 509 deepEqual(probedURLs, [ | 469 deepEqual(probedURLs, [ |
| 510 MockResultsBaseURL.replace('Mock_Builder', 'MockBuilder1') + "/failing_r
esults.json", | 470 MockResultsBaseURL.replace('Mock_Builder', 'MockBuilder1') + "/failing_r
esults.json", |
| 511 MockResultsBaseURL.replace('Mock_Builder', 'MockBuilder2') + "/failing_r
esults.json" | 471 MockResultsBaseURL.replace('Mock_Builder', 'MockBuilder2') + "/failing_r
esults.json" |
| 512 ]); | 472 ]); |
| 513 | 473 |
| 514 }); | 474 }); |
| 515 | 475 |
| 516 })(); | 476 })(); |
| OLD | NEW |