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

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

Issue 8055036: Revert 103010 - Refactored code to move cloudprint specific code into print_preview_cloud.js. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/webui/print_preview_handler.cc ('k') | printing/print_job_constants.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 /** 5 /**
6 * Test fixture for print preview WebUI testing. 6 * Test fixture for print preview WebUI testing.
7 * @extends {testing.Test} 7 * @extends {testing.Test}
8 * @constructor 8 * @constructor
9 */ 9 */
10 function PrintPreviewWebUITest() {} 10 function PrintPreviewWebUITest() {}
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 expectEquals('FooDevice', printerList.options[fooIndex].value, 228 expectEquals('FooDevice', printerList.options[fooIndex].value,
229 'fooIndex=' + fooIndex); 229 'fooIndex=' + fooIndex);
230 expectEquals('BarName', printerList.options[barIndex].text, 230 expectEquals('BarName', printerList.options[barIndex].text,
231 'barIndex=' + barIndex); 231 'barIndex=' + barIndex);
232 expectEquals('BarDevice', printerList.options[barIndex].value, 232 expectEquals('BarDevice', printerList.options[barIndex].value,
233 'barIndex=' + barIndex); 233 'barIndex=' + barIndex);
234 }); 234 });
235 235
236 // Test that the printer list is structured correctly after calling 236 // Test that the printer list is structured correctly after calling
237 // addCloudPrinters with an empty list. 237 // addCloudPrinters with an empty list.
238 TEST_F('PrintPreviewWebUITest', 'TestPrinterListCloudEmpty', function() { 238 TEST_F('PrintPreviewWebUITest', 'FLAKY_TestPrinterListCloudEmpty', function() {
239 cloudprint.addCloudPrinters([], addDestinationListOptionAtPosition); 239 addCloudPrinters([]);
240 var printerList = $('printer-list'); 240 var printerList = $('printer-list');
241 assertNotEquals(null, printerList); 241 assertNotEquals(null, printerList);
242 expectEquals(localStrings.getString('cloudPrinters'),
243 printerList.options[0].text);
244 expectEquals(localStrings.getString('addCloudPrinter'),
245 printerList.options[1].text);
242 }); 246 });
243 247
244 // Test that the printer list is structured correctly after calling 248 // Test that the printer list is structured correctly after calling
245 // addCloudPrinters with a null list. 249 // addCloudPrinters with a null list.
246 TEST_F('PrintPreviewWebUITest', 'TestPrinterListCloudNull', function() { 250 TEST_F('PrintPreviewWebUITest', 'FLAKY_TestPrinterListCloudNull', function() {
247 cloudprint.addCloudPrinters(null, addDestinationListOptionAtPosition); 251 addCloudPrinters(null);
248 var printerList = $('printer-list'); 252 var printerList = $('printer-list');
249 assertNotEquals(null, printerList); 253 assertNotEquals(null, printerList);
254 expectEquals(localStrings.getString('cloudPrinters'),
255 printerList.options[0].text);
250 expectEquals(localStrings.getString('signIn'), 256 expectEquals(localStrings.getString('signIn'),
251 printerList.options[0].text); 257 printerList.options[1].text);
252 }); 258 });
253 259
254 // Test that the printer list is structured correctly after attempting to add 260 // Test that the printer list is structured correctly after attempting to add
255 // individual cloud printers until no more can be added. 261 // individual cloud printers until no more can be added.
256 TEST_F('PrintPreviewWebUITest', 'TestPrinterListCloud', function() { 262 TEST_F('PrintPreviewWebUITest', 'FLAKY_TestPrinterListCloud', function() {
257 var printerList = $('printer-list'); 263 var printerList = $('printer-list');
258 assertNotEquals(null, printerList); 264 assertNotEquals(null, printerList);
259 var printer = new Object; 265 var printer = new Object;
260 printer['name'] = 'FooCloud'; 266 printer['name'] = 'FooCloud';
261 for (var i = 0; i < maxCloudPrinters; i++) { 267 for (var i = 0; i < maxCloudPrinters; i++) {
262 printer['id'] = String(i); 268 printer['id'] = String(i);
263 cloudprint.addCloudPrinters([printer], addDestinationListOptionAtPosition); 269 addCloudPrinters([printer]);
264 expectEquals('FooCloud', printerList.options[i].text); 270 expectEquals(localStrings.getString('cloudPrinters'),
265 expectEquals(String(i), printerList.options[i].value); 271 printerList.options[0].text);
272 expectEquals('FooCloud', printerList.options[i + 1].text);
273 expectEquals(String(i), printerList.options[i + 1].value);
266 } 274 }
267 cloudprint.addCloudPrinters([printer], addDestinationListOptionAtPosition); 275 printer['id'] = maxCloudPrinters + 1;
268 expectNotEquals('FooCloud', printerList.options[i].text); 276 addCloudPrinters([printer]);
269 expectNotEquals(String(i), printerList.options[i].value); 277 expectEquals('', printerList.options[maxCloudPrinters + 1].text);
270 for (var i = 0; i < maxCloudPrinters; i++) { 278 expectEquals(localStrings.getString('morePrinters'),
271 expectEquals('FooCloud', printerList.options[i].text); 279 printerList.options[maxCloudPrinters + 2].text);
272 expectEquals(String(i), printerList.options[i].value);
273 }
274 }); 280 });
275 281
276 /** 282 /**
277 * Verify that |section| visibility matches |visible|. 283 * Verify that |section| visibility matches |visible|.
278 * @param {HTMLDivElement} section The section to check. 284 * @param {HTMLDivElement} section The section to check.
279 * @param {boolean} visible The expected state of visibility. 285 * @param {boolean} visible The expected state of visibility.
280 */ 286 */
281 function checkSectionVisible(section, visible) { 287 function checkSectionVisible(section, visible) {
282 assertNotEquals(null, section); 288 assertNotEquals(null, section);
283 expectEquals(section.classList.contains('visible'), visible, 289 expectEquals(section.classList.contains('visible'), visible,
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 446
441 // Test that error message is displayed when plugin doesn't exist. 447 // Test that error message is displayed when plugin doesn't exist.
442 TEST_F('PrintPreviewNoPDFWebUITest', 'TestErrorMessage', function() { 448 TEST_F('PrintPreviewNoPDFWebUITest', 'TestErrorMessage', function() {
443 var errorButton = $('error-button'); 449 var errorButton = $('error-button');
444 assertNotEquals(null, errorButton); 450 assertNotEquals(null, errorButton);
445 expectFalse(errorButton.disabled); 451 expectFalse(errorButton.disabled);
446 var errorText = $('custom-message'); 452 var errorText = $('custom-message');
447 assertNotEquals(null, errorText); 453 assertNotEquals(null, errorText);
448 expectFalse(errorText.classList.contains('hidden')); 454 expectFalse(errorText.classList.contains('hidden'));
449 }); 455 });
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/print_preview_handler.cc ('k') | printing/print_job_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698