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

Unified Diff: extensions/test/data/api_test/printer_provider/request_print/test.js

Issue 973993003: Instead of ArrayBuffer, pass blob with printerProvider.onPrintRequested (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 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 side-by-side diff with in-line comments
Download patch
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');

Powered by Google App Engine
This is Rietveld 408576698