| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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("expectedFailures", 1, function() { | |
| 157 var expectedFailures = results.expectedFailures(unittest.kExampleResultsJSON
); | |
| 158 deepEqual(expectedFailures, { | |
| 159 "scrollbars/custom-scrollbar-with-incomplete-style.html": { | |
| 160 "expected": "IMAGE", | |
| 161 "actual": "IMAGE" | |
| 162 }, | |
| 163 "userscripts/user-script-video-document.html": { | |
| 164 "expected": "FAIL", | |
| 165 "actual": "TEXT" | |
| 166 } | |
| 167 }); | |
| 168 }); | |
| 169 | |
| 170 test("unexpectedFailures", 1, function() { | 156 test("unexpectedFailures", 1, function() { |
| 171 var unexpectedFailures = results.unexpectedFailures(unittest.kExampleResults
JSON); | 157 var unexpectedFailures = results.unexpectedFailures(unittest.kExampleResults
JSON); |
| 172 deepEqual(unexpectedFailures, { | 158 deepEqual(unexpectedFailures, { |
| 173 "userscripts/another-test.html": { | 159 "userscripts/another-test.html": { |
| 174 "expected": "PASS", | 160 "expected": "PASS", |
| 175 "actual": "TEXT", | 161 "actual": "TEXT", |
| 176 "is_unexpected": true, | 162 "is_unexpected": true, |
| 177 } | 163 } |
| 178 }); | 164 }); |
| 179 }); | 165 }); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 "taco": { | 408 "taco": { |
| 423 "expected": "PASS", | 409 "expected": "PASS", |
| 424 "actual": "TEXT" | 410 "actual": "TEXT" |
| 425 }, | 411 }, |
| 426 }; | 412 }; |
| 427 | 413 |
| 428 var collectedResults = results.collectUnexpectedResults(dictionaryOfResultNo
des); | 414 var collectedResults = results.collectUnexpectedResults(dictionaryOfResultNo
des); |
| 429 deepEqual(collectedResults, ["TEXT", "IMAGE"]); | 415 deepEqual(collectedResults, ["TEXT", "IMAGE"]); |
| 430 }); | 416 }); |
| 431 | 417 |
| 432 test("failureTypeToExtensionList", 5, function() { | |
| 433 deepEqual(results.failureTypeToExtensionList('TEXT'), ['txt']); | |
| 434 deepEqual(results.failureTypeToExtensionList('IMAGE+TEXT'), ['txt', 'png']); | |
| 435 deepEqual(results.failureTypeToExtensionList('IMAGE'), ['png']); | |
| 436 deepEqual(results.failureTypeToExtensionList('CRASH'), []); | |
| 437 deepEqual(results.failureTypeToExtensionList('TIMEOUT'), []); | |
| 438 }); | |
| 439 | |
| 440 asyncTest("fetchResultsURLs", 5, function() { | 418 asyncTest("fetchResultsURLs", 5, function() { |
| 441 var simulator = new NetworkSimulator(); | 419 var simulator = new NetworkSimulator(); |
| 442 | 420 |
| 443 var probedURLs = []; | 421 var probedURLs = []; |
| 444 simulator.probe = function(url) | 422 simulator.probe = function(url) |
| 445 { | 423 { |
| 446 probedURLs.push(url); | 424 probedURLs.push(url); |
| 447 if (base.endsWith(url, '.txt')) | 425 if (base.endsWith(url, '.txt')) |
| 448 return Promise.resolve(); | 426 return Promise.resolve(); |
| 449 else if (/taco.+png$/.test(url)) | 427 else if (/taco.+png$/.test(url)) |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 }).then(start); | 498 }).then(start); |
| 521 | 499 |
| 522 deepEqual(probedURLs, [ | 500 deepEqual(probedURLs, [ |
| 523 MockResultsBaseURL.replace('Mock_Builder', 'MockBuilder1') + "/failing_r
esults.json", | 501 MockResultsBaseURL.replace('Mock_Builder', 'MockBuilder1') + "/failing_r
esults.json", |
| 524 MockResultsBaseURL.replace('Mock_Builder', 'MockBuilder2') + "/failing_r
esults.json" | 502 MockResultsBaseURL.replace('Mock_Builder', 'MockBuilder2') + "/failing_r
esults.json" |
| 525 ]); | 503 ]); |
| 526 | 504 |
| 527 }); | 505 }); |
| 528 | 506 |
| 529 })(); | 507 })(); |
| OLD | NEW |