| Index: chrome/test/data/webui/print_preview/print_preview.js
|
| diff --git a/chrome/test/data/webui/print_preview/print_preview.js b/chrome/test/data/webui/print_preview/print_preview.js
|
| index 55a52053dfcf916db2040563aa73c5c5a0d069d6..3986fbabccbae5c856f6e3819c5e1ceaac3983e7 100644
|
| --- a/chrome/test/data/webui/print_preview/print_preview.js
|
| +++ b/chrome/test/data/webui/print_preview/print_preview.js
|
| @@ -18,27 +18,6 @@ function PrintPreviewWebUITest() {
|
| this.previewArea_ = null;
|
| }
|
|
|
| -/**
|
| - * Index of the "Save as PDF" printer.
|
| - * @type {number}
|
| - * @const
|
| - */
|
| -PrintPreviewWebUITest.PDF_INDEX = 0;
|
| -
|
| -/**
|
| - * Index of the Foo printer.
|
| - * @type {number}
|
| - * @const
|
| - */
|
| -PrintPreviewWebUITest.FOO_INDEX = 1;
|
| -
|
| -/**
|
| - * Index of the Bar printer.
|
| - * @type {number}
|
| - * @const
|
| - */
|
| -PrintPreviewWebUITest.BAR_INDEX = 2;
|
| -
|
| PrintPreviewWebUITest.prototype = {
|
| __proto__: testing.Test.prototype,
|
|
|
| @@ -248,96 +227,6 @@ PrintPreviewWebUITest.prototype = {
|
| },
|
| };
|
|
|
| -// Test some basic assumptions about the print preview WebUI.
|
| -TEST_F('PrintPreviewWebUITest', 'TestPrinterList', function() {
|
| - this.setInitialSettings();
|
| - this.nativeLayer_.whenCalled('getInitialSettings').then(
|
| - function() {
|
| - this.setLocalDestinations();
|
| - var recentList =
|
| - $('destination-search').querySelector('.recent-list ul');
|
| - var localList =
|
| - $('destination-search').querySelector('.local-list ul');
|
| - assertNotEquals(null, recentList);
|
| - assertEquals(1, recentList.childNodes.length);
|
| - assertEquals('FooName',
|
| - recentList.childNodes.item(0).querySelector(
|
| - '.destination-list-item-name').textContent);
|
| - assertNotEquals(null, localList);
|
| - assertEquals(3, localList.childNodes.length);
|
| - assertEquals('Save as PDF',
|
| - localList.childNodes.item(PrintPreviewWebUITest.PDF_INDEX).
|
| - querySelector('.destination-list-item-name').textContent);
|
| - assertEquals('FooName',
|
| - localList.childNodes.item(PrintPreviewWebUITest.FOO_INDEX).
|
| - querySelector('.destination-list-item-name').textContent);
|
| - assertEquals('BarName',
|
| - localList.childNodes.item(PrintPreviewWebUITest.BAR_INDEX).
|
| - querySelector('.destination-list-item-name').textContent);
|
| - testDone();
|
| - }.bind(this));
|
| -});
|
| -
|
| -// Test that the printer list is structured correctly after calling
|
| -// addCloudPrinters with an empty list.
|
| -TEST_F('PrintPreviewWebUITest', 'TestPrinterListCloudEmpty', function() {
|
| - this.setInitialSettings();
|
| -
|
| - this.nativeLayer_.whenCalled('getInitialSettings').then(
|
| - function() {
|
| - this.setLocalDestinations();
|
| -
|
| - var cloudPrintEnableEvent =
|
| - new Event(print_preview.NativeLayer.EventType.CLOUD_PRINT_ENABLE);
|
| - cloudPrintEnableEvent.baseCloudPrintUrl = 'cloudprint url';
|
| - this.nativeLayer_.getEventTarget().dispatchEvent(
|
| - cloudPrintEnableEvent);
|
| -
|
| - var searchDoneEvent =
|
| - new Event(cloudprint.CloudPrintInterfaceEventType.SEARCH_DONE);
|
| - searchDoneEvent.printers = [];
|
| - searchDoneEvent.isRecent = true;
|
| - searchDoneEvent.email = 'foo@chromium.org';
|
| - this.printPreview_.cloudPrintInterface_.dispatchEvent(searchDoneEvent);
|
| -
|
| - var recentList =
|
| - $('destination-search').querySelector('.recent-list ul');
|
| - var localList =
|
| - $('destination-search').querySelector('.local-list ul');
|
| - var cloudList =
|
| - $('destination-search').querySelector('.cloud-list ul');
|
| -
|
| - assertNotEquals(null, recentList);
|
| - assertEquals(1, recentList.childNodes.length);
|
| - assertEquals('FooName',
|
| - recentList.childNodes.item(0).
|
| - querySelector('.destination-list-item-name').
|
| - textContent);
|
| -
|
| - assertNotEquals(null, localList);
|
| - assertEquals(3, localList.childNodes.length);
|
| - assertEquals('Save as PDF',
|
| - localList.childNodes.item(
|
| - PrintPreviewWebUITest.PDF_INDEX).
|
| - querySelector('.destination-list-item-name').
|
| - textContent);
|
| - assertEquals('FooName',
|
| - localList.childNodes.
|
| - item(PrintPreviewWebUITest.FOO_INDEX).
|
| - querySelector('.destination-list-item-name').
|
| - textContent);
|
| - assertEquals('BarName',
|
| - localList.childNodes.
|
| - item(PrintPreviewWebUITest.BAR_INDEX).
|
| - querySelector('.destination-list-item-name').
|
| - textContent);
|
| -
|
| - assertNotEquals(null, cloudList);
|
| - assertEquals(0, cloudList.childNodes.length);
|
| -
|
| - testDone();
|
| - }.bind(this));
|
| -});
|
|
|
| /**
|
| * Verify that |section| visibility matches |visible|.
|
| @@ -406,115 +295,6 @@ function isPrintAsImageEnabled() {
|
| loadTimeData.getBoolean('printPdfAsImageEnabled'));
|
| }
|
|
|
| -// Test restore settings with one destination.
|
| -TEST_F('PrintPreviewWebUITest', 'TestPrintPreviewRestoreLocalDestination',
|
| - function() {
|
| - this.initialSettings_.serializedAppStateStr_ =
|
| - '{"version":2,"recentDestinations":[{"id":"ID", "origin":"local",' +
|
| - '"account":"", "capabilities":0, "name":"", "extensionId":"",' +
|
| - '"extensionName":""}]}';
|
| -
|
| - this.setInitialSettings();
|
| - this.nativeLayer_.whenCalled('getInitialSettings').then(
|
| - function() {
|
| - testDone();
|
| - });
|
| -});
|
| -
|
| -// Test with multiple destinations
|
| -TEST_F('PrintPreviewWebUITest', 'TestPrintPreviewRestoreMultipleDestinations',
|
| - function() {
|
| - var origin = cr.isChromeOS ? "chrome_os" : "local";
|
| -
|
| - var appState = {
|
| - 'version': 2,
|
| - 'recentDestinations': [
|
| - {
|
| - 'id': 'ID1',
|
| - 'origin': origin,
|
| - 'account': '',
|
| - 'capabilities': 0,
|
| - 'name': '',
|
| - 'extensionId': '',
|
| - 'extensionName': ''
|
| - },
|
| - {
|
| - 'id': 'ID2',
|
| - 'origin': origin,
|
| - 'account': '',
|
| - 'capabilities': 0,
|
| - 'name': '',
|
| - 'extensionId': '',
|
| - 'extensionName': ''
|
| - },
|
| - {
|
| - 'id': 'ID3',
|
| - 'origin': origin,
|
| - 'account': '',
|
| - 'capabilities': 0,
|
| - 'name': '',
|
| - 'extensionId': '',
|
| - 'extensionName': ''
|
| - }
|
| - ]
|
| - };
|
| -
|
| - this.initialSettings_.serializedAppStateStr_ = JSON.stringify(appState);
|
| - this.setInitialSettings();
|
| -
|
| - this.nativeLayer_.whenCalled('getInitialSettings').then(
|
| - function() {
|
| - // Set capabilities for the three recently used destinations + 1 more
|
| - this.setCapabilities(getCddTemplate('ID1'));
|
| - this.setCapabilities(getCddTemplate('ID2'));
|
| - this.setCapabilities(getCddTemplate('ID3'));
|
| - this.setCapabilities(getCddTemplate('ID4'));
|
| -
|
| - // The most recently used destination should be the currently selected
|
| - // one. This is ID1.
|
| - assertEquals(
|
| - 'ID1', this.printPreview_.destinationStore_.selectedDestination.id);
|
| -
|
| - // Look through the destinations. ID1, ID2, and ID3 should all be
|
| - // recent.
|
| - var destinations = this.printPreview_.destinationStore_.destinations_;
|
| - var idsFound = [];
|
| -
|
| - for (var i = 0; i < destinations.length; i++) {
|
| - if (!destinations[i])
|
| - continue;
|
| - if (destinations[i].isRecent)
|
| - idsFound.push(destinations[i].id);
|
| - }
|
| -
|
| - // Make sure there were 3 recent destinations and that they are the
|
| - // correct IDs.
|
| - assertEquals(3, idsFound.length);
|
| - assertNotEquals(-1, idsFound.indexOf("ID1"));
|
| - assertNotEquals(-1, idsFound.indexOf("ID2"));
|
| - assertNotEquals(-1, idsFound.indexOf("ID3"));
|
| -
|
| - testDone();
|
| - }.bind(this));
|
| -});
|
| -
|
| -TEST_F('PrintPreviewWebUITest',
|
| - 'TestPrintPreviewDefaultDestinationSelectionRules', function() {
|
| - // It also makes sure these rules do override system default destination.
|
| - this.initialSettings_.serializedDefaultDestinationSelectionRulesStr_ =
|
| - '{"namePattern":".*Bar.*"}';
|
| - this.setInitialSettings();
|
| - this.nativeLayer_.whenCalled('getInitialSettings').then(
|
| - function() {
|
| - this.setLocalDestinations();
|
| -
|
| - assertEquals(
|
| - 'BarDevice',
|
| - this.printPreview_.destinationStore_.selectedDestination.id);
|
| -
|
| - testDone();
|
| - }.bind(this));
|
| -});
|
|
|
| TEST_F('PrintPreviewWebUITest', 'TestSystemDialogLinkIsHiddenInAppKioskMode',
|
| function() {
|
|
|