OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 GEN('#include "base/feature_list.h"'); | 5 GEN('#include "base/feature_list.h"'); |
6 GEN('#include "chrome/common/chrome_features.h"'); | 6 GEN('#include "chrome/common/chrome_features.h"'); |
7 | 7 |
8 /** | 8 /** |
9 * Test fixture for print preview WebUI testing. | 9 * Test fixture for print preview WebUI testing. |
10 * @constructor | 10 * @constructor |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 print_preview.NativeLayer.EventType = oldNativeLayerEventType; | 104 print_preview.NativeLayer.EventType = oldNativeLayerEventType; |
105 print_preview.NativeLayer.DuplexMode = oldDuplexMode; | 105 print_preview.NativeLayer.DuplexMode = oldDuplexMode; |
106 | 106 |
107 function CloudPrintInterfaceStub() { | 107 function CloudPrintInterfaceStub() { |
108 cr.EventTarget.call(this); | 108 cr.EventTarget.call(this); |
109 } | 109 } |
110 CloudPrintInterfaceStub.prototype = { | 110 CloudPrintInterfaceStub.prototype = { |
111 __proto__: cr.EventTarget.prototype, | 111 __proto__: cr.EventTarget.prototype, |
112 search: function(isRecent) {} | 112 search: function(isRecent) {} |
113 }; | 113 }; |
114 var oldCpInterfaceEventType = cloudprint.CloudPrintInterface.EventType; | 114 var oldCpInterfaceEventType = cloudprint.CloudPrintInterfaceEventType; |
115 cloudprint.CloudPrintInterface = CloudPrintInterfaceStub; | 115 cloudprint.CloudPrintInterface = CloudPrintInterfaceStub; |
116 cloudprint.CloudPrintInterface.EventType = oldCpInterfaceEventType; | 116 cloudprint.CloudPrintInterfaceEventType = oldCpInterfaceEventType; |
117 | 117 |
118 print_preview.PreviewArea.prototype.checkPluginCompatibility_ = | 118 print_preview.PreviewArea.prototype.checkPluginCompatibility_ = |
119 function() { | 119 function() { |
120 return false; | 120 return false; |
121 }; | 121 }; |
122 }.bind(this)); | 122 }.bind(this)); |
123 }, | 123 }, |
124 | 124 |
125 /** | 125 /** |
126 * Dispatch the INITIAL_SETTINGS_SET event. This call is NOT async and will | 126 * Dispatch the INITIAL_SETTINGS_SET event. This call is NOT async and will |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 TEST_F('PrintPreviewWebUITest', 'TestPrinterListCloudEmpty', function() { | 304 TEST_F('PrintPreviewWebUITest', 'TestPrinterListCloudEmpty', function() { |
305 this.setInitialSettings(); | 305 this.setInitialSettings(); |
306 this.setLocalDestinations(); | 306 this.setLocalDestinations(); |
307 | 307 |
308 var cloudPrintEnableEvent = | 308 var cloudPrintEnableEvent = |
309 new Event(print_preview.NativeLayer.EventType.CLOUD_PRINT_ENABLE); | 309 new Event(print_preview.NativeLayer.EventType.CLOUD_PRINT_ENABLE); |
310 cloudPrintEnableEvent.baseCloudPrintUrl = 'cloudprint url'; | 310 cloudPrintEnableEvent.baseCloudPrintUrl = 'cloudprint url'; |
311 this.nativeLayer_.dispatchEvent(cloudPrintEnableEvent); | 311 this.nativeLayer_.dispatchEvent(cloudPrintEnableEvent); |
312 | 312 |
313 var searchDoneEvent = | 313 var searchDoneEvent = |
314 new Event(cloudprint.CloudPrintInterface.EventType.SEARCH_DONE); | 314 new Event(cloudprint.CloudPrintInterfaceEventType.SEARCH_DONE); |
315 searchDoneEvent.printers = []; | 315 searchDoneEvent.printers = []; |
316 searchDoneEvent.isRecent = true; | 316 searchDoneEvent.isRecent = true; |
317 searchDoneEvent.email = 'foo@chromium.org'; | 317 searchDoneEvent.email = 'foo@chromium.org'; |
318 printPreview.cloudPrintInterface_.dispatchEvent(searchDoneEvent); | 318 printPreview.cloudPrintInterface_.dispatchEvent(searchDoneEvent); |
319 | 319 |
320 var recentList = $('destination-search').querySelector('.recent-list ul'); | 320 var recentList = $('destination-search').querySelector('.recent-list ul'); |
321 var localList = $('destination-search').querySelector('.local-list ul'); | 321 var localList = $('destination-search').querySelector('.local-list ul'); |
322 var cloudList = $('destination-search').querySelector('.cloud-list ul'); | 322 var cloudList = $('destination-search').querySelector('.cloud-list ul'); |
323 | 323 |
324 assertNotEquals(null, recentList); | 324 assertNotEquals(null, recentList); |
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 this.dispatchPreviewDone(); | 1442 this.dispatchPreviewDone(); |
1443 | 1443 |
1444 // Has active print button and successfully "prints", indicating recovery | 1444 // Has active print button and successfully "prints", indicating recovery |
1445 // from error state. | 1445 // from error state. |
1446 expectFalse(printButton.disabled); | 1446 expectFalse(printButton.disabled); |
1447 expectFalse(this.hasPrinted()); | 1447 expectFalse(this.hasPrinted()); |
1448 printButton.click(); | 1448 printButton.click(); |
1449 expectTrue(this.hasPrinted()); | 1449 expectTrue(this.hasPrinted()); |
1450 testDone(); | 1450 testDone(); |
1451 }); | 1451 }); |
OLD | NEW |