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

Side by Side Diff: chrome/test/data/webui/print_preview/native_layer_stub.js

Issue 2920153004: Print Preview: Change getPrivetPrinters to cr.sendWithPromise (Closed)
Patch Set: Change notation Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/webui/print_preview/print_preview_handler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('print_preview', function() { 5 cr.define('print_preview', function() {
6 /** 6 /**
7 * Test version of the native layer. 7 * Test version of the native layer.
8 * @constructor 8 * @constructor
9 * @extends {TestBrowserProxy} 9 * @extends {TestBrowserProxy}
10 */ 10 */
11 function NativeLayerStub() { 11 function NativeLayerStub() {
12 TestBrowserProxy.call(this, [ 12 TestBrowserProxy.call(this, [
13 'getInitialSettings', 13 'getInitialSettings',
14 'getPrinters', 14 'getPrinters',
15 'getExtensionPrinters', 15 'getExtensionPrinters',
16 'getPrivetPrinters',
16 'setupPrinter' 17 'setupPrinter'
17 ]); 18 ]);
18 19
19 /** 20 /**
20 * @private {!cr.EventTarget} The event target used for dispatching and 21 * @private {!cr.EventTarget} The event target used for dispatching and
21 * receiving events. 22 * receiving events.
22 */ 23 */
23 this.eventTarget_ = new cr.EventTarget(); 24 this.eventTarget_ = new cr.EventTarget();
24 25
25 /** @private {boolean} Whether the native layer has sent a print message. */ 26 /** @private {boolean} Whether the native layer has sent a print message. */
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 return Promise.resolve(this.localDestinationInfos_); 84 return Promise.resolve(this.localDestinationInfos_);
84 }, 85 },
85 86
86 /** @override */ 87 /** @override */
87 getExtensionPrinters: function() { 88 getExtensionPrinters: function() {
88 this.methodCalled('getExtensionPrinters'); 89 this.methodCalled('getExtensionPrinters');
89 return Promise.resolve(true); 90 return Promise.resolve(true);
90 }, 91 },
91 92
92 /** @override */ 93 /** @override */
94 getPrivetPrinters: function() {
95 this.methodCalled('getPrivetPrinters');
96 return Promise.resolve(true);
97 },
98
99 /** @override */
93 setupPrinter: function(printerId) { 100 setupPrinter: function(printerId) {
94 this.methodCalled('setupPrinter', printerId); 101 this.methodCalled('setupPrinter', printerId);
95 return this.shouldRejectPrinterSetup_ ? 102 return this.shouldRejectPrinterSetup_ ?
96 Promise.reject(this.setupPrinterResponse_) : 103 Promise.reject(this.setupPrinterResponse_) :
97 Promise.resolve(this.setupPrinterResponse_); 104 Promise.resolve(this.setupPrinterResponse_);
98 }, 105 },
99 106
100 /** Stubs for |print_preview.NativeLayer| methods that call C++ handlers. */ 107 /** Stubs for |print_preview.NativeLayer| methods that call C++ handlers. */
101 previewReadyForTest: function() {}, 108 previewReadyForTest: function() {},
102 startGetLocalDestinations: function() {},
103 startGetPrivetDestinations: function() {},
104 startGetLocalDestinationCapabilities: function(destinationId) { 109 startGetLocalDestinationCapabilities: function(destinationId) {
105 if (destinationId == this.destinationToWatch_) 110 if (destinationId == this.destinationToWatch_)
106 this.getLocalDestinationCapabilitiesCallCount_++; 111 this.getLocalDestinationCapabilitiesCallCount_++;
107 }, 112 },
108 startGetPreview: function(destination, printTicketStore, documentInfo, 113 startGetPreview: function(destination, printTicketStore, documentInfo,
109 generateDraft, requestId) { 114 generateDraft, requestId) {
110 this.generateDraft_ = generateDraft; 115 this.generateDraft_ = generateDraft;
111 }, 116 },
112 startPrint: function () { this.printStarted_ = true; }, 117 startPrint: function () { this.printStarted_ = true; },
113 startHideDialog: function () {}, 118 startHideDialog: function () {},
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 setSetupPrinterResponse: function(reject, response) { 174 setSetupPrinterResponse: function(reject, response) {
170 this.shouldRejectPrinterSetup_ = reject; 175 this.shouldRejectPrinterSetup_ = reject;
171 this.setupPrinterResponse_ = response; 176 this.setupPrinterResponse_ = response;
172 }, 177 },
173 }; 178 };
174 179
175 return { 180 return {
176 NativeLayerStub: NativeLayerStub, 181 NativeLayerStub: NativeLayerStub,
177 }; 182 };
178 }); 183 });
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/print_preview/print_preview_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698