Chromium Code Reviews| Index: extensions/test/data/api_test/printer_provider/request_print/test.js |
| diff --git a/extensions/test/data/api_test/printer_provider/request_print/test.js b/extensions/test/data/api_test/printer_provider/request_print/test.js |
| index 868898dd1fdcf8251d7578cd7b398daca0ccd937..80491ddbcceb1573590a231fc935506bb8655f8c 100644 |
| --- a/extensions/test/data/api_test/printer_provider/request_print/test.js |
| +++ b/extensions/test/data/api_test/printer_provider/request_print/test.js |
| @@ -2,6 +2,15 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +function readBlob(blob, callback) { |
| + var reader = new FileReader(); |
| + reader.onerror = function() { callback(null); }; |
| + reader.onloadend = function() { |
| + callback(reader.result); |
| + } |
| + reader.readAsText(blob) |
| +} |
| + |
| chrome.test.sendMessage('loaded', function(test) { |
| chrome.test.runTests([function printTest() { |
| if (test == 'NO_LISTENER') { |
| @@ -33,18 +42,31 @@ chrome.test.sendMessage('loaded', function(test) { |
| 'Invalid value for argument 1. ' + |
| 'Value must be one of: ' + |
| '[OK, FAILED, INVALID_TICKET, INVALID_DATA].'); |
| + chrome.test.succeed(); |
| + } else if (test == 'OK') { |
|
not at google - send to devlin
2015/03/04 21:54:50
Looks odd that the rest of the test uses the patte
tbarzic
2015/03/04 23:24:34
Done.
|
| + readBlob(job.document, function(content) { |
| + callback(!!content ? 'OK' : 'INVALID_DATA'); |
| + |
| + if (content) |
| + chrome.test.assertEq('bytes', content); |
| + |
| + chrome.test.assertThrows( |
| + callback, |
| + [test], |
| + 'Event callback must not be called more than once.'); |
| + chrome.test.succeed(); |
| + }); |
| } else { |
| - chrome.test.assertTrue(test == 'OK' || test == 'FAILED' || |
| - test == 'INVALID_TICKET' || test == 'INVALID_DATA'); |
| + chrome.test.assertTrue(test == 'FAILED' || test == 'INVALID_TICKET' || |
| + test == 'INVALID_DATA'); |
|
not at google - send to devlin
2015/03/04 21:54:50
If you used a switch you could make this look a bi
tbarzic
2015/03/04 23:24:34
Done.
|
| callback(test); |
| + chrome.test.assertThrows( |
| + callback, |
| + [test], |
| + 'Event callback must not be called more than once.'); |
| + chrome.test.succeed(); |
| } |
| - chrome.test.assertThrows( |
| - callback, |
| - [test], |
| - 'Event callback must not be called more than once.'); |
| - |
| - chrome.test.succeed(); |
| }); |
| chrome.test.sendMessage('ready'); |