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

Unified Diff: chrome/test/data/webui/print_preview/native_layer_stub.js

Issue 2919693002: Print Preview: Change getPrinters to cr.sendWithPromise (Closed)
Patch Set: Fix comments Created 3 years, 7 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: chrome/test/data/webui/print_preview/native_layer_stub.js
diff --git a/chrome/test/data/webui/print_preview/native_layer_stub.js b/chrome/test/data/webui/print_preview/native_layer_stub.js
index d16b11b77a1f6e7b13cb4ca1f9de3ce1b39114c5..ef65b8f19e82c7124a91c1ab3c86ec43b865b9ce 100644
--- a/chrome/test/data/webui/print_preview/native_layer_stub.js
+++ b/chrome/test/data/webui/print_preview/native_layer_stub.js
@@ -10,7 +10,7 @@ cr.define('print_preview', function() {
*/
function NativeLayerStub() {
settings.TestBrowserProxy.call(this, [
- 'getInitialSettings', 'setupPrinter' ]);
+ 'getInitialSettings', 'getPrinters', 'setupPrinter' ]);
/**
* @private {!cr.EventTarget} The event target used for dispatching and
@@ -34,6 +34,13 @@ cr.define('print_preview', function() {
this.initialSettings_ = null;
/**
+ *
+ * @private {Array<print_preview.LocalDestinationInfo>} Local destination
dpapad 2017/06/01 19:01:53 ?Array<! Or set initial value to an empty array,
rbpotter 2017/06/01 22:31:12 Done.
+ * list to be used for the response to |getPrinters|.
+ */
+ this.localDestinationInfos_ = null;
+
+ /**
* @private {!print_preview.PrinterSetupResponse} The response to be sent
* on a |setupPrinter| call.
*/
@@ -67,6 +74,12 @@ cr.define('print_preview', function() {
},
/** @override */
+ getPrinters: function() {
+ this.methodCalled('getPrinters');
+ return Promise.resolve(this.localDestinationInfos_);
+ },
+
+ /** @override */
setupPrinter: function(printerId) {
this.methodCalled('setupPrinter', printerId);
return this.shouldRejectPrinterSetup_ ?
@@ -132,6 +145,14 @@ cr.define('print_preview', function() {
},
/**
+ * @param {!Array<print_preview.LocalDestinationInfo>} localDestinations
+ * The local destinations to return as a response to |getPrinters|.
+ */
+ setLocalDestinations: function(localDestinations) {
+ this.localDestinationInfos_ = localDestinations;
+ },
+
+ /**
* @param {boolean} reject Whether printSetup requests should be rejected.
* @param {!print_preview.PrinterSetupResponse} The response to send when
* |setupPrinter| is called.

Powered by Google App Engine
This is Rietveld 408576698