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

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

Issue 2919693002: Print Preview: Change getPrinters to cr.sendWithPromise (Closed)
Patch Set: Address 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..92f9f29e15bce49e8e81b90e8cdf97e6e48b2133 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
+ * list to be used for the response to |getPrinters|.
+ */
+ this.localDestinationInfos_ = [];
+
+ /**
* @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