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

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

Issue 2973743002: Add plugin stub for print preview tests (Closed)
Patch Set: Fix comments Created 3 years, 5 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 cr.define('print_preview', function() {
6 /**
7 * Test version of the print preview plugin
8 * @param {print_preview.PreviewArea} The PreviewArea that owns this plugin.
dpapad 2017/07/06 00:24:17 !print_preview.PreviewArea
rbpotter 2017/07/06 01:57:27 Done.
9 * @constructor
10 */
11 function PDFPluginStub(area) {
dpapad 2017/07/06 00:24:17 Can we use the new ES6 class syntax, which we rece
rbpotter 2017/07/06 01:57:28 Done.
12 /** @private {Object} The callback to run when the plugin has loaded. */
dpapad 2017/07/06 00:24:17 ?Function
rbpotter 2017/07/06 01:57:27 Done.
13 this.loadCallback_ = null;
14
15 /** @private {EventTracker} The plugin stub's event tracker. */
dpapad 2017/07/06 00:24:17 !EventTracker
rbpotter 2017/07/06 01:57:28 Done.
16 this.tracker_ = new EventTracker();
17
18 // Call documentLoadComplete as soon as the preview area starts the preview.
19 this.tracker_.add(
20 area,
21 print_preview.PreviewArea.EventType.PREVIEW_GENERATION_IN_PROGRESS,
22 this.documentLoadComplete.bind(this));
23 }
24
25 PDFPluginStub.prototype = {
26 /**
27 * @param {Object} callback The callback to run when the plugin has loaded.
28 */
29 setLoadCallback: function(callback) {
30 this.loadCallback_ = callback;
31 },
32
33 documentLoadComplete: function() {
34 if (this.loadCallback_)
35 this.loadCallback_();
36 },
37
38 /**
39 * Stubbed out since some tests result in a call.
40 * @param {string} url The url to initialize the plugin to.
41 * @param {boolean} color Whether the preview should be in color.
42 * @param {Array<int>} pages The pages to preview.
dpapad 2017/07/06 00:24:17 !Array<number>
rbpotter 2017/07/06 01:57:28 Done.
43 * @param {boolean} modifiable Whether the source document is modifiable.
44 */
45 resetPrintPreviewMode: function(url, color, pages, modifiable) {},
46 };
47
48 return {
49 PDFPluginStub: PDFPluginStub,
50 };
51 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698