Chromium Code Reviews| 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 /** | 5 /** |
| 6 * Test fixture for print preview WebUI testing. | 6 * Test fixture for print preview WebUI testing. |
| 7 * @constructor | 7 * @constructor |
| 8 * @extends {testing.Test} | 8 * @extends {testing.Test} |
| 9 */ | 9 */ |
| 10 function PrintPreviewWebUITest() { | 10 function PrintPreviewWebUITest() { |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 236 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 236 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
| 237 | 237 |
| 238 var localDestsSetEvent = | 238 var localDestsSetEvent = |
| 239 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); | 239 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); |
| 240 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; | 240 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; |
| 241 this.nativeLayer_.dispatchEvent(localDestsSetEvent); | 241 this.nativeLayer_.dispatchEvent(localDestsSetEvent); |
| 242 | 242 |
| 243 var capsSetEvent = | 243 var capsSetEvent = |
| 244 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 244 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
| 245 capsSetEvent.settingsInfo = { | 245 capsSetEvent.settingsInfo = { |
| 246 'printerId': 'FooDevice', | 246 "printerId": "FooDevice", |
| 247 'disableColorOption': true, | 247 "capabilities": { |
| 248 'setColorAsDefault': true, | 248 "version": "1.0", |
| 249 'disableCopiesOption': true, | 249 "printer": { |
| 250 'disableLandscapeOption': false, | 250 "supported_content_type": [{"content_type": "application/pdf"}], |
| 251 'printerDefaultDuplexValue': 0 | 251 "collate": {}, |
| 252 "color": { | |
| 253 "option": [ | |
| 254 {"is_default": true, "type": "STANDARD_COLOR"} | |
| 255 ] | |
| 256 }, | |
| 257 "duplex": { | |
| 258 "option": [ | |
| 259 {"is_default": true, "type": "NO_DUPLEX"}, | |
| 260 {"type": "LONG_EDGE"}, | |
| 261 {"type": "SHORT_EDGE"} | |
| 262 ] | |
| 263 }, | |
| 264 "page_orientation": { | |
| 265 "option": [ | |
| 266 {"is_default": true, "type": "PORTRAIT"}, | |
| 267 {"type": "LANDSCAPE"}, | |
| 268 {"type": "AUTO"} | |
| 269 ] | |
| 270 } | |
| 271 } | |
| 272 } | |
| 252 }; | 273 }; |
| 253 this.nativeLayer_.dispatchEvent(capsSetEvent); | 274 this.nativeLayer_.dispatchEvent(capsSetEvent); |
| 254 | 275 |
| 255 checkSectionVisible($('layout-settings'), true); | 276 checkSectionVisible($('layout-settings'), true); |
| 256 checkSectionVisible($('color-settings'), false); | 277 checkSectionVisible($('color-settings'), false); |
| 257 checkSectionVisible($('copies-settings'), false); | 278 checkSectionVisible($('copies-settings'), false); |
| 258 }); | 279 }); |
| 259 | 280 |
| 260 // When the source is 'PDF' and 'Save as PDF' option is selected, we hide the | 281 // When the source is 'PDF' and 'Save as PDF' option is selected, we hide the |
| 261 // fit to page option. | 282 // fit to page option. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 315 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 336 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
| 316 | 337 |
| 317 var localDestsSetEvent = | 338 var localDestsSetEvent = |
| 318 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); | 339 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); |
| 319 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; | 340 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; |
| 320 this.nativeLayer_.dispatchEvent(localDestsSetEvent); | 341 this.nativeLayer_.dispatchEvent(localDestsSetEvent); |
| 321 | 342 |
| 322 var capsSetEvent = | 343 var capsSetEvent = |
| 323 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 344 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
| 324 capsSetEvent.settingsInfo = { | 345 capsSetEvent.settingsInfo = { |
| 325 'printerId': 'FooDevice', | 346 "printerId": "FooDevice", |
| 326 'disableColorOption': false, | 347 "capabilities": { |
| 327 'setColorAsDefault': true, | 348 "version": "1.0", |
| 328 'disableCopiesOption': true, | 349 "printer": { |
| 329 'disableLandscapeOption': true, | 350 "supported_content_type": [{"content_type": "application/pdf"}], |
| 330 'printerDefaultDuplexValue': 0 | 351 "collate": {}, |
| 352 "color": { | |
| 353 "option": [ | |
| 354 {"is_default": true, "type": "STANDARD_COLOR"}, | |
| 355 {"type": "STANDARD_MONOCHROME"} | |
| 356 ] | |
| 357 }, | |
| 358 "copies": {}, | |
| 359 "duplex": { | |
| 360 "option": [ | |
| 361 {"is_default": true, "type": "NO_DUPLEX"}, | |
| 362 {"type": "LONG_EDGE"}, | |
| 363 {"type": "SHORT_EDGE"} | |
| 364 ] | |
| 365 }, | |
| 366 "page_orientation": { | |
| 367 "option": [ | |
| 368 {"is_default": true, "type": "PORTRAIT"}, | |
| 369 {"type": "LANDSCAPE"}, | |
| 370 {"type": "AUTO"} | |
| 371 ] | |
| 372 } | |
| 373 } | |
| 374 } | |
| 331 }; | 375 }; |
| 332 this.nativeLayer_.dispatchEvent(capsSetEvent); | 376 this.nativeLayer_.dispatchEvent(capsSetEvent); |
| 333 | 377 |
| 334 checkElementDisplayed( | 378 checkElementDisplayed( |
| 335 $('other-options-settings').querySelector('.fit-to-page-container'), | 379 $('other-options-settings').querySelector('.fit-to-page-container'), |
| 336 false); | 380 false); |
| 337 }); | 381 }); |
| 338 | 382 |
| 339 // When the source is "PDF", depending on the selected destination printer, we | 383 // When the source is "PDF", depending on the selected destination printer, we |
| 340 // show/hide the fit to page option. | 384 // show/hide the fit to page option. |
| 341 TEST_F('PrintPreviewWebUITest', 'SourceIsPDFShowFitToPageOption', function() { | 385 TEST_F('PrintPreviewWebUITest', 'SourceIsPDFShowFitToPageOption', function() { |
| 342 this.initialSettings_.isDocumentModifiable_ = false; | 386 this.initialSettings_.isDocumentModifiable_ = false; |
| 343 | 387 |
| 344 var initialSettingsSetEvent = | 388 var initialSettingsSetEvent = |
| 345 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); | 389 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); |
| 346 initialSettingsSetEvent.initialSettings = this.initialSettings_; | 390 initialSettingsSetEvent.initialSettings = this.initialSettings_; |
| 347 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 391 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
| 348 | 392 |
| 349 var localDestsSetEvent = | 393 var localDestsSetEvent = |
| 350 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); | 394 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); |
| 351 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; | 395 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; |
| 352 this.nativeLayer_.dispatchEvent(localDestsSetEvent); | 396 this.nativeLayer_.dispatchEvent(localDestsSetEvent); |
| 353 | 397 |
| 354 var capsSetEvent = | 398 var capsSetEvent = |
| 355 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 399 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
| 356 capsSetEvent.settingsInfo = { | 400 capsSetEvent.settingsInfo = { |
| 357 'printerId': 'FooDevice', | 401 "printerId": "FooDevice", |
| 358 'disableColorOption': false, | 402 "capabilities": { |
| 359 'setColorAsDefault': true, | 403 "version": "1.0", |
| 360 'disableCopiesOption': true, | 404 "printer": { |
| 361 'disableLandscapeOption': true, | 405 "supported_content_type": [{"content_type": "application/pdf"}], |
| 362 'printerDefaultDuplexValue': 0 | 406 "collate": {}, |
| 407 "color": { | |
| 408 "option": [ | |
| 409 {"is_default": true, "type": "STANDARD_COLOR"}, | |
| 410 {"type": "STANDARD_MONOCHROME"} | |
| 411 ] | |
| 412 }, | |
| 413 "copies": {}, | |
| 414 "duplex": { | |
| 415 "option": [ | |
| 416 {"is_default": true, "type": "NO_DUPLEX"}, | |
| 417 {"type": "LONG_EDGE"}, | |
| 418 {"type": "SHORT_EDGE"} | |
| 419 ] | |
| 420 }, | |
| 421 "page_orientation": { | |
| 422 "option": [ | |
| 423 {"is_default": true, "type": "PORTRAIT"}, | |
| 424 {"type": "LANDSCAPE"}, | |
| 425 {"type": "AUTO"} | |
| 426 ] | |
| 427 } | |
| 428 } | |
| 429 } | |
| 363 }; | 430 }; |
| 364 this.nativeLayer_.dispatchEvent(capsSetEvent); | 431 this.nativeLayer_.dispatchEvent(capsSetEvent); |
| 365 | 432 |
| 366 checkElementDisplayed( | 433 checkElementDisplayed( |
| 367 $('other-options-settings').querySelector('.fit-to-page-container'), | 434 $('other-options-settings').querySelector('.fit-to-page-container'), |
| 368 true); | 435 true); |
| 369 expectTrue( | 436 expectTrue( |
| 370 $('other-options-settings').querySelector('.fit-to-page-checkbox'). | 437 $('other-options-settings').querySelector('.fit-to-page-checkbox'). |
| 371 checked); | 438 checked); |
| 372 }); | 439 }); |
| 373 | 440 |
| 374 // When the print scaling is disabled for the source "PDF", we show the fit | 441 // When the print scaling is disabled for the source "PDF", we show the fit |
| 375 // to page option but the state is unchecked by default. | 442 // to page option but the state is unchecked by default. |
| 376 TEST_F('PrintPreviewWebUITest', 'PrintScalingDisabledForPlugin', function() { | 443 TEST_F('PrintPreviewWebUITest', 'PrintScalingDisabledForPlugin', function() { |
| 377 this.initialSettings_.isDocumentModifiable_ = false; | 444 this.initialSettings_.isDocumentModifiable_ = false; |
| 378 | 445 |
| 379 var initialSettingsSetEvent = | 446 var initialSettingsSetEvent = |
| 380 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); | 447 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); |
| 381 initialSettingsSetEvent.initialSettings = this.initialSettings_; | 448 initialSettingsSetEvent.initialSettings = this.initialSettings_; |
| 382 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 449 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
| 383 | 450 |
| 384 var localDestsSetEvent = | 451 var localDestsSetEvent = |
| 385 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); | 452 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); |
| 386 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; | 453 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; |
| 387 this.nativeLayer_.dispatchEvent(localDestsSetEvent); | 454 this.nativeLayer_.dispatchEvent(localDestsSetEvent); |
| 388 | 455 |
| 389 var capsSetEvent = | 456 var capsSetEvent = |
| 390 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 457 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
| 391 capsSetEvent.settingsInfo = { | 458 capsSetEvent.settingsInfo = { |
| 392 'printerId': 'FooDevice', | 459 "printerId": "FooDevice", |
| 393 'disableColorOption': false, | 460 "capabilities": { |
| 394 'setColorAsDefault': true, | 461 "version": "1.0", |
| 395 'disableCopiesOption': true, | 462 "printer": { |
| 396 'disableLandscapeOption': true, | 463 "supported_content_type": [{"content_type": "application/pdf"}], |
| 397 'printerDefaultDuplexValue': 0 | 464 "collate": {}, |
| 465 "color": { | |
| 466 "option": [ | |
| 467 {"is_default": true, "type": "STANDARD_COLOR"}, | |
| 468 {"type": "STANDARD_MONOCHROME"} | |
| 469 ] | |
| 470 }, | |
| 471 "copies": {}, | |
| 472 "duplex": { | |
| 473 "option": [ | |
| 474 {"is_default": true, "type": "NO_DUPLEX"}, | |
| 475 {"type": "LONG_EDGE"}, | |
| 476 {"type": "SHORT_EDGE"} | |
| 477 ] | |
| 478 }, | |
| 479 "page_orientation": { | |
| 480 "option": [ | |
| 481 {"is_default": true, "type": "PORTRAIT"}, | |
| 482 {"type": "LANDSCAPE"}, | |
| 483 {"type": "AUTO"} | |
| 484 ] | |
| 485 } | |
| 486 } | |
| 487 } | |
| 398 }; | 488 }; |
| 399 this.nativeLayer_.dispatchEvent(capsSetEvent); | 489 this.nativeLayer_.dispatchEvent(capsSetEvent); |
| 400 | 490 |
| 401 // Indicate that the PDF does not support scaling by default. | 491 // Indicate that the PDF does not support scaling by default. |
| 402 cr.dispatchSimpleEvent( | 492 cr.dispatchSimpleEvent( |
| 403 this.nativeLayer_, print_preview.NativeLayer.EventType.DISABLE_SCALING); | 493 this.nativeLayer_, print_preview.NativeLayer.EventType.DISABLE_SCALING); |
| 404 | 494 |
| 405 checkElementDisplayed( | 495 checkElementDisplayed( |
| 406 $('other-options-settings').querySelector('.fit-to-page-container'), | 496 $('other-options-settings').querySelector('.fit-to-page-container'), |
| 407 true); | 497 true); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 420 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 510 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
| 421 | 511 |
| 422 var localDestsSetEvent = | 512 var localDestsSetEvent = |
| 423 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); | 513 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); |
| 424 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; | 514 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; |
| 425 this.nativeLayer_.dispatchEvent(localDestsSetEvent); | 515 this.nativeLayer_.dispatchEvent(localDestsSetEvent); |
| 426 | 516 |
| 427 var capsSetEvent = | 517 var capsSetEvent = |
| 428 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 518 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
| 429 capsSetEvent.settingsInfo = { | 519 capsSetEvent.settingsInfo = { |
| 430 'printerId': 'FooDevice', | 520 "printerId": "FooDevice", |
| 431 'disableColorOption': false, | 521 "capabilities": { |
| 432 'setColorAsDefault': true, | 522 "version": "1.0", |
| 433 'disableCopiesOption': true, | 523 "printer": { |
| 434 'disableLandscapeOption': true, | 524 "supported_content_type": [{"content_type": "application/pdf"}], |
| 435 'printerDefaultDuplexValue': 0 | 525 "collate": {}, |
| 526 "color": { | |
| 527 "option": [ | |
| 528 {"is_default": true, "type": "STANDARD_COLOR"}, | |
| 529 {"type": "STANDARD_MONOCHROME"} | |
| 530 ] | |
| 531 }, | |
| 532 "copies": {}, | |
| 533 "duplex": { | |
| 534 "option": [ | |
| 535 {"is_default": true, "type": "NO_DUPLEX"}, | |
| 536 {"type": "LONG_EDGE"}, | |
| 537 {"type": "SHORT_EDGE"} | |
| 538 ] | |
| 539 }, | |
| 540 "page_orientation": { | |
| 541 "option": [ | |
| 542 {"is_default": true, "type": "PORTRAIT"}, | |
| 543 {"type": "LANDSCAPE"}, | |
| 544 {"type": "AUTO"} | |
| 545 ] | |
| 546 } | |
| 547 } | |
| 548 } | |
| 436 }; | 549 }; |
| 437 this.nativeLayer_.dispatchEvent(capsSetEvent); | 550 this.nativeLayer_.dispatchEvent(capsSetEvent); |
| 438 | 551 |
| 439 checkElementDisplayed( | 552 checkElementDisplayed( |
| 440 $('other-options-settings').querySelector('.header-footer-container'), | 553 $('other-options-settings').querySelector('.header-footer-container'), |
| 441 true); | 554 true); |
| 442 | 555 |
| 443 printPreview.printTicketStore_.marginsType.updateValue( | 556 printPreview.printTicketStore_.marginsType.updateValue( |
| 444 print_preview.ticket_items.MarginsType.Value.CUSTOM); | 557 print_preview.ticket_items.MarginsType.Value.CUSTOM); |
| 445 printPreview.printTicketStore_.customMargins.updateValue( | 558 printPreview.printTicketStore_.customMargins.updateValue( |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 460 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 573 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
| 461 | 574 |
| 462 var localDestsSetEvent = | 575 var localDestsSetEvent = |
| 463 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); | 576 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); |
| 464 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; | 577 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; |
| 465 this.nativeLayer_.dispatchEvent(localDestsSetEvent); | 578 this.nativeLayer_.dispatchEvent(localDestsSetEvent); |
| 466 | 579 |
| 467 var capsSetEvent = | 580 var capsSetEvent = |
| 468 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 581 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
| 469 capsSetEvent.settingsInfo = { | 582 capsSetEvent.settingsInfo = { |
| 470 'printerId': 'FooDevice', | 583 "printerId": "FooDevice", |
| 471 'disableColorOption': false, | 584 "capabilities": { |
| 472 'setColorAsDefault': true, | 585 "version": "1.0", |
| 473 'disableCopiesOption': true, | 586 "printer": { |
| 474 'disableLandscapeOption': true, | 587 "supported_content_type": [{"content_type": "application/pdf"}], |
| 475 'printerDefaultDuplexValue': 0 | 588 "collate": {}, |
| 589 "color": { | |
| 590 "option": [ | |
| 591 {"is_default": true, "type": "STANDARD_COLOR"}, | |
| 592 {"type": "STANDARD_MONOCHROME"} | |
| 593 ] | |
| 594 }, | |
| 595 "copies": {}, | |
| 596 "duplex": { | |
| 597 "option": [ | |
| 598 {"is_default": true, "type": "NO_DUPLEX"}, | |
| 599 {"type": "LONG_EDGE"}, | |
| 600 {"type": "SHORT_EDGE"} | |
| 601 ] | |
| 602 }, | |
| 603 "page_orientation": { | |
| 604 "option": [ | |
| 605 {"is_default": true, "type": "PORTRAIT"}, | |
| 606 {"type": "LANDSCAPE"}, | |
| 607 {"type": "AUTO"} | |
| 608 ] | |
| 609 } | |
| 610 } | |
| 611 } | |
| 476 }; | 612 }; |
| 477 this.nativeLayer_.dispatchEvent(capsSetEvent); | 613 this.nativeLayer_.dispatchEvent(capsSetEvent); |
| 478 | 614 |
| 479 checkElementDisplayed( | 615 checkElementDisplayed( |
| 480 $('other-options-settings').querySelector('.header-footer-container'), | 616 $('other-options-settings').querySelector('.header-footer-container'), |
| 481 true); | 617 true); |
| 482 | 618 |
| 483 printPreview.printTicketStore_.marginsType.updateValue( | 619 printPreview.printTicketStore_.marginsType.updateValue( |
| 484 print_preview.ticket_items.MarginsType.Value.CUSTOM); | 620 print_preview.ticket_items.MarginsType.Value.CUSTOM); |
| 485 printPreview.printTicketStore_.customMargins.updateValue( | 621 printPreview.printTicketStore_.customMargins.updateValue( |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 500 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 636 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
| 501 | 637 |
| 502 var localDestsSetEvent = | 638 var localDestsSetEvent = |
| 503 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); | 639 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); |
| 504 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; | 640 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; |
| 505 this.nativeLayer_.dispatchEvent(localDestsSetEvent); | 641 this.nativeLayer_.dispatchEvent(localDestsSetEvent); |
| 506 | 642 |
| 507 var capsSetEvent = | 643 var capsSetEvent = |
| 508 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 644 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
| 509 capsSetEvent.settingsInfo = { | 645 capsSetEvent.settingsInfo = { |
| 510 'printerId': 'FooDevice', | 646 "printerId": "FooDevice", |
| 511 'disableColorOption': false, | 647 "capabilities": { |
| 512 'setColorAsDefault': true, | 648 "version": "1.0", |
| 513 'disableCopiesOption': true, | 649 "printer": { |
| 514 'disableLandscapeOption': true, | 650 "supported_content_type": [{"content_type": "application/pdf"}], |
| 515 'printerDefaultDuplexValue': 0 | 651 "collate": {}, |
| 652 "color": { | |
| 653 "option": [ | |
| 654 {"is_default": true, "type": "STANDARD_COLOR"}, | |
| 655 {"type": "STANDARD_MONOCHROME"} | |
| 656 ] | |
| 657 }, | |
| 658 "copies": {}, | |
| 659 "duplex": { | |
| 660 "option": [ | |
| 661 {"is_default": true, "type": "NO_DUPLEX"}, | |
| 662 {"type": "LONG_EDGE"}, | |
| 663 {"type": "SHORT_EDGE"} | |
| 664 ] | |
| 665 }, | |
| 666 "page_orientation": { | |
| 667 "option": [ | |
| 668 {"is_default": true, "type": "PORTRAIT"}, | |
| 669 {"type": "LANDSCAPE"}, | |
| 670 {"type": "AUTO"} | |
| 671 ] | |
| 672 } | |
| 673 } | |
| 674 } | |
| 516 }; | 675 }; |
| 517 this.nativeLayer_.dispatchEvent(capsSetEvent); | 676 this.nativeLayer_.dispatchEvent(capsSetEvent); |
| 518 | 677 |
| 519 checkElementDisplayed( | 678 checkElementDisplayed( |
| 520 $('other-options-settings').querySelector('.header-footer-container'), | 679 $('other-options-settings').querySelector('.header-footer-container'), |
| 521 true); | 680 true); |
| 522 | 681 |
| 523 printPreview.printTicketStore_.marginsType.updateValue( | 682 printPreview.printTicketStore_.marginsType.updateValue( |
| 524 print_preview.ticket_items.MarginsType.Value.CUSTOM); | 683 print_preview.ticket_items.MarginsType.Value.CUSTOM); |
| 525 printPreview.printTicketStore_.customMargins.updateValue( | 684 printPreview.printTicketStore_.customMargins.updateValue( |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 541 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 700 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
| 542 | 701 |
| 543 var localDestsSetEvent = | 702 var localDestsSetEvent = |
| 544 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); | 703 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); |
| 545 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; | 704 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; |
| 546 this.nativeLayer_.dispatchEvent(localDestsSetEvent); | 705 this.nativeLayer_.dispatchEvent(localDestsSetEvent); |
| 547 | 706 |
| 548 var capsSetEvent = | 707 var capsSetEvent = |
| 549 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 708 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
| 550 capsSetEvent.settingsInfo = { | 709 capsSetEvent.settingsInfo = { |
| 551 'printerId': 'FooDevice', | 710 "printerId": "FooDevice", |
| 552 'disableColorOption': false, | 711 "capabilities": { |
| 553 'setColorAsDefault': true, | 712 "version": "1.0", |
| 554 'disableCopiesOption': true, | 713 "printer": { |
| 555 'disableLandscapeOption': true, | 714 "supported_content_type": [{"content_type": "application/pdf"}], |
| 556 'printerDefaultDuplexValue': 0 | 715 "collate": {}, |
| 716 "color": { | |
| 717 "option": [ | |
| 718 {"is_default": true, "type": "STANDARD_COLOR"}, | |
| 719 {"type": "STANDARD_MONOCHROME"} | |
| 720 ] | |
| 721 }, | |
| 722 "copies": {}, | |
| 723 "duplex": { | |
| 724 "option": [ | |
| 725 {"is_default": true, "type": "NO_DUPLEX"}, | |
| 726 {"type": "LONG_EDGE"}, | |
| 727 {"type": "SHORT_EDGE"} | |
| 728 ] | |
| 729 }, | |
| 730 "page_orientation": { | |
| 731 "option": [ | |
| 732 {"is_default": true, "type": "PORTRAIT"}, | |
| 733 {"type": "LANDSCAPE"}, | |
| 734 {"type": "AUTO"} | |
| 735 ] | |
| 736 } | |
| 737 } | |
| 738 } | |
| 557 }; | 739 }; |
| 558 this.nativeLayer_.dispatchEvent(capsSetEvent); | 740 this.nativeLayer_.dispatchEvent(capsSetEvent); |
| 559 | 741 |
| 560 checkElementDisplayed( | 742 checkElementDisplayed( |
| 561 $('other-options-settings').querySelector('.header-footer-container'), | 743 $('other-options-settings').querySelector('.header-footer-container'), |
| 562 true); | 744 true); |
| 563 | 745 |
| 564 printPreview.printTicketStore_.marginsType.updateValue( | 746 printPreview.printTicketStore_.marginsType.updateValue( |
| 565 print_preview.ticket_items.MarginsType.Value.CUSTOM); | 747 print_preview.ticket_items.MarginsType.Value.CUSTOM); |
| 566 printPreview.printTicketStore_.customMargins.updateValue( | 748 printPreview.printTicketStore_.customMargins.updateValue( |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 579 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 761 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
| 580 | 762 |
| 581 var localDestsSetEvent = | 763 var localDestsSetEvent = |
| 582 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); | 764 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); |
| 583 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; | 765 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; |
| 584 this.nativeLayer_.dispatchEvent(localDestsSetEvent); | 766 this.nativeLayer_.dispatchEvent(localDestsSetEvent); |
| 585 | 767 |
| 586 var capsSetEvent = | 768 var capsSetEvent = |
| 587 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 769 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
| 588 capsSetEvent.settingsInfo = { | 770 capsSetEvent.settingsInfo = { |
| 589 'printerId': 'FooDevice', | 771 "printerId": "FooDevice", |
| 590 'disableColorOption': false, | 772 "capabilities": { |
| 591 'setColorAsDefault': true, | 773 "version": "1.0", |
| 592 'disableCopiesOption': false, | 774 "printer": { |
| 593 'disableLandscapeOption': true, | 775 "supported_content_type": [{"content_type": "application/pdf"}], |
| 594 'printerDefaultDuplexValue': 0 | 776 "collate": {}, |
| 777 "color": { | |
| 778 "option": [ | |
| 779 {"is_default": true, "type": "STANDARD_COLOR"}, | |
| 780 {"type": "STANDARD_MONOCHROME"} | |
| 781 ] | |
| 782 }, | |
| 783 "copies": {}, | |
| 784 "duplex": { | |
| 785 "option": [ | |
| 786 {"is_default": true, "type": "NO_DUPLEX"}, | |
| 787 {"type": "LONG_EDGE"}, | |
| 788 {"type": "SHORT_EDGE"} | |
| 789 ] | |
| 790 }, | |
| 791 "page_orientation": { | |
| 792 "option": [ | |
| 793 {"is_default": true, "type": "PORTRAIT"}, | |
| 794 {"type": "LANDSCAPE"}, | |
| 795 {"type": "AUTO"} | |
| 796 ] | |
| 797 } | |
| 798 } | |
| 799 } | |
| 595 }; | 800 }; |
| 596 this.nativeLayer_.dispatchEvent(capsSetEvent); | 801 this.nativeLayer_.dispatchEvent(capsSetEvent); |
| 597 | 802 |
| 598 checkSectionVisible($('color-settings'), true); | 803 checkSectionVisible($('color-settings'), true); |
| 599 | 804 |
| 600 var colorOption = $('color-settings').querySelector('.color-option'); | 805 var colorOption = $('color-settings').querySelector('.color-option'); |
| 601 var bwOption = $('color-settings').querySelector('.bw-option'); | 806 var bwOption = $('color-settings').querySelector('.bw-option'); |
| 602 expectTrue(colorOption.checked); | 807 expectTrue(colorOption.checked); |
| 603 expectFalse(bwOption.checked); | 808 expectFalse(bwOption.checked); |
| 604 }); | 809 }); |
| 605 | 810 |
| 606 //Test that the color settings are set according to the printer capabilities. | 811 //Test that the color settings are set according to the printer capabilities. |
| 607 TEST_F('PrintPreviewWebUITest', 'TestColorSettingsFalse', function() { | 812 TEST_F('PrintPreviewWebUITest', 'TestColorSettingsFalse', function() { |
| 608 var initialSettingsSetEvent = | 813 var initialSettingsSetEvent = |
| 609 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); | 814 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); |
| 610 initialSettingsSetEvent.initialSettings = this.initialSettings_; | 815 initialSettingsSetEvent.initialSettings = this.initialSettings_; |
| 611 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 816 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
| 612 | 817 |
| 613 var localDestsSetEvent = | 818 var localDestsSetEvent = |
| 614 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); | 819 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); |
| 615 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; | 820 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; |
| 616 this.nativeLayer_.dispatchEvent(localDestsSetEvent); | 821 this.nativeLayer_.dispatchEvent(localDestsSetEvent); |
| 617 | 822 |
| 618 var capsSetEvent = | 823 var capsSetEvent = |
| 619 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 824 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
| 620 capsSetEvent.settingsInfo = { | 825 capsSetEvent.settingsInfo = { |
| 621 'printerId': 'FooDevice', | 826 "printerId": "FooDevice", |
| 622 'disableColorOption': true, | 827 "capabilities": { |
| 623 'setColorAsDefault': false, | 828 "version": "1.0", |
| 624 'disableCopiesOption': false, | 829 "printer": { |
| 625 'disableLandscapeOption': true, | 830 "supported_content_type": [{"content_type": "application/pdf"}], |
| 626 'printerDefaultDuplexValue': 0 | 831 "collate": {}, |
| 832 "color": { | |
| 833 "option": [ | |
| 834 {"is_default": true, "type": "STANDARD_MONOCHROME"} | |
| 835 ] | |
| 836 }, | |
| 837 "copies": {}, | |
| 838 "duplex": { | |
| 839 "option": [ | |
| 840 {"is_default": true, "type": "NO_DUPLEX"}, | |
| 841 {"type": "LONG_EDGE"}, | |
| 842 {"type": "SHORT_EDGE"} | |
| 843 ] | |
| 844 }, | |
| 845 "page_orientation": { | |
| 846 "option": [ | |
| 847 {"is_default": true, "type": "PORTRAIT"}, | |
| 848 {"type": "LANDSCAPE"}, | |
| 849 {"type": "AUTO"} | |
| 850 ] | |
| 851 } | |
| 852 } | |
| 853 } | |
| 627 }; | 854 }; |
| 628 this.nativeLayer_.dispatchEvent(capsSetEvent); | 855 this.nativeLayer_.dispatchEvent(capsSetEvent); |
| 629 | 856 |
| 630 checkSectionVisible($('color-settings'), false); | 857 checkSectionVisible($('color-settings'), false); |
| 631 | 858 |
| 632 var colorOption = $('color-settings').querySelector('.color-option'); | 859 var colorOption = $('color-settings').querySelector('.color-option'); |
| 633 var bwOption = $('color-settings').querySelector('.bw-option'); | 860 var bwOption = $('color-settings').querySelector('.bw-option'); |
| 634 expectFalse(colorOption.checked); | 861 expectFalse(colorOption.checked); |
| 635 expectTrue(bwOption.checked); | 862 expectTrue(bwOption.checked); |
| 636 }); | 863 }); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 648 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; | 875 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; |
| 649 this.nativeLayer_.dispatchEvent(localDestsSetEvent); | 876 this.nativeLayer_.dispatchEvent(localDestsSetEvent); |
| 650 | 877 |
| 651 var otherOptionsDiv = $('other-options-settings'); | 878 var otherOptionsDiv = $('other-options-settings'); |
| 652 var duplexDiv = otherOptionsDiv.querySelector('.duplex-container'); | 879 var duplexDiv = otherOptionsDiv.querySelector('.duplex-container'); |
| 653 var duplexCheckbox = otherOptionsDiv.querySelector('.duplex-checkbox'); | 880 var duplexCheckbox = otherOptionsDiv.querySelector('.duplex-checkbox'); |
| 654 | 881 |
| 655 var capsSetEvent = | 882 var capsSetEvent = |
| 656 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 883 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
| 657 capsSetEvent.settingsInfo = { | 884 capsSetEvent.settingsInfo = { |
| 658 'printerId': 'FooDevice', | 885 "printerId": "FooDevice", |
| 659 'disableColorOption': false, | 886 "capabilities": { |
| 660 'setColorAsDefault': true, | 887 "version": "1.0", |
| 661 'disableCopiesOption': false, | 888 "printer": { |
| 662 'disableLandscapeOption': true, | 889 "supported_content_type": [{"content_type": "application/pdf"}], |
| 663 'printerDefaultDuplexValue': 0, | 890 "collate": {}, |
| 664 'setDuplexAsDefault': false | 891 "color": { |
| 892 "option": [ | |
| 893 {"is_default": true, "type": "STANDARD_COLOR"}, | |
| 894 {"type": "STANDARD_MONOCHROME"} | |
| 895 ] | |
| 896 }, | |
| 897 "copies": {}, | |
| 898 "duplex": { | |
| 899 "option": [ | |
| 900 {"is_default": true, "type": "NO_DUPLEX"}, | |
| 901 {"type": "LONG_EDGE"}, | |
| 902 {"type": "SHORT_EDGE"} | |
| 903 ] | |
| 904 }, | |
| 905 "page_orientation": { | |
| 906 "option": [ | |
| 907 {"is_default": true, "type": "PORTRAIT"}, | |
| 908 {"type": "LANDSCAPE"}, | |
| 909 {"type": "AUTO"} | |
| 910 ] | |
| 911 } | |
| 912 } | |
| 913 } | |
| 665 }; | 914 }; |
| 666 this.nativeLayer_.dispatchEvent(capsSetEvent); | 915 this.nativeLayer_.dispatchEvent(capsSetEvent); |
| 667 | 916 |
| 668 checkSectionVisible(otherOptionsDiv, true); | 917 checkSectionVisible(otherOptionsDiv, true); |
| 669 expectFalse(duplexDiv.hidden); | 918 expectFalse(duplexDiv.hidden); |
| 670 expectFalse(duplexCheckbox.checked); | 919 expectFalse(duplexCheckbox.checked); |
| 671 }); | 920 }); |
| 672 | 921 |
| 673 //Test to verify that duplex settings are set according to the printer | 922 //Test to verify that duplex settings are set according to the printer |
| 674 //capabilities. | 923 //capabilities. |
| 675 TEST_F('PrintPreviewWebUITest', 'TestDuplexSettingsFalse', function() { | 924 TEST_F('PrintPreviewWebUITest', 'TestDuplexSettingsFalse', function() { |
| 676 var initialSettingsSetEvent = | 925 var initialSettingsSetEvent = |
| 677 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); | 926 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); |
| 678 initialSettingsSetEvent.initialSettings = this.initialSettings_; | 927 initialSettingsSetEvent.initialSettings = this.initialSettings_; |
| 679 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 928 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
| 680 | 929 |
| 681 var localDestsSetEvent = | 930 var localDestsSetEvent = |
| 682 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); | 931 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); |
| 683 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; | 932 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; |
| 684 this.nativeLayer_.dispatchEvent(localDestsSetEvent); | 933 this.nativeLayer_.dispatchEvent(localDestsSetEvent); |
| 685 | 934 |
| 686 var otherOptionsDiv = $('other-options-settings'); | 935 var otherOptionsDiv = $('other-options-settings'); |
| 687 var duplexDiv = otherOptionsDiv.querySelector('.duplex-container'); | 936 var duplexDiv = otherOptionsDiv.querySelector('.duplex-container'); |
| 688 | 937 |
| 689 var capsSetEvent = | 938 var capsSetEvent = |
| 690 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 939 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
| 691 capsSetEvent.settingsInfo = { | 940 capsSetEvent.settingsInfo = { |
| 692 'printerId': 'FooDevice', | 941 "printerId": "FooDevice", |
| 693 'disableColorOption': false, | 942 "capabilities": { |
| 694 'setColorAsDefault': true, | 943 "version": "1.0", |
| 695 'disableCopiesOption': false, | 944 "printer": { |
| 696 'disableLandscapeOption': true, | 945 "supported_content_type": [{"content_type": "application/pdf"}], |
| 697 'printerDefaultDuplexValue': -1, | 946 "collate": {}, |
| 698 'setDuplexAsDefault': false | 947 "color": { |
| 948 "option": [ | |
| 949 {"is_default": true, "type": "STANDARD_COLOR"}, | |
| 950 {"type": "STANDARD_MONOCHROME"} | |
| 951 ] | |
| 952 }, | |
| 953 "copies": {}, | |
| 954 "page_orientation": { | |
| 955 "option": [ | |
| 956 {"is_default": true, "type": "PORTRAIT"}, | |
| 957 {"type": "LANDSCAPE"}, | |
| 958 {"type": "AUTO"} | |
| 959 ] | |
| 960 } | |
| 961 } | |
| 962 } | |
| 699 }; | 963 }; |
| 700 this.nativeLayer_.dispatchEvent(capsSetEvent); | 964 this.nativeLayer_.dispatchEvent(capsSetEvent); |
| 701 | 965 |
| 702 checkSectionVisible(otherOptionsDiv, true); | 966 checkSectionVisible(otherOptionsDiv, true); |
| 703 expectTrue(duplexDiv.hidden); | 967 expectTrue(duplexDiv.hidden); |
| 704 }); | 968 }); |
| 705 | 969 |
| 706 // Test that changing the selected printer updates the preview. | 970 // Test that changing the selected printer updates the preview. |
| 707 TEST_F('PrintPreviewWebUITest', 'TestPrinterChangeUpdatesPreview', function() { | 971 TEST_F('PrintPreviewWebUITest', 'TestPrinterChangeUpdatesPreview', function() { |
| 708 | 972 |
| 709 var initialSettingsSetEvent = | 973 var initialSettingsSetEvent = |
| 710 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); | 974 new Event(print_preview.NativeLayer.EventType.INITIAL_SETTINGS_SET); |
| 711 initialSettingsSetEvent.initialSettings = this.initialSettings_; | 975 initialSettingsSetEvent.initialSettings = this.initialSettings_; |
| 712 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); | 976 this.nativeLayer_.dispatchEvent(initialSettingsSetEvent); |
| 713 | 977 |
| 714 var localDestsSetEvent = | 978 var localDestsSetEvent = |
| 715 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); | 979 new Event(print_preview.NativeLayer.EventType.LOCAL_DESTINATIONS_SET); |
| 716 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; | 980 localDestsSetEvent.destinationInfos = this.localDestinationInfos_; |
| 717 this.nativeLayer_.dispatchEvent(localDestsSetEvent); | 981 this.nativeLayer_.dispatchEvent(localDestsSetEvent); |
| 718 | 982 |
| 719 var capsSetEvent = | 983 var capsSetEvent = |
| 720 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 984 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
| 721 capsSetEvent.settingsInfo = { | 985 capsSetEvent.settingsInfo = { |
| 722 'printerId': 'FooDevice', | 986 "printerId": "FooDevice", |
| 723 'disableColorOption': false, | 987 "capabilities": { |
| 724 'setColorAsDefault': true, | 988 "version": "1.0", |
| 725 'disableCopiesOption': true, | 989 "printer": { |
| 726 'disableLandscapeOption': true, | 990 "supported_content_type": [{"content_type": "application/pdf"}], |
| 727 'printerDefaultDuplexValue': 0 | 991 "collate": {}, |
| 992 "color": { | |
| 993 "option": [ | |
| 994 {"is_default": true, "type": "STANDARD_COLOR"}, | |
| 995 {"type": "STANDARD_MONOCHROME"} | |
| 996 ] | |
| 997 }, | |
| 998 "copies": {}, | |
| 999 "duplex": { | |
| 1000 "option": [ | |
| 1001 {"is_default": true, "type": "NO_DUPLEX"}, | |
| 1002 {"type": "LONG_EDGE"}, | |
|
Vitaly Buka (NO REVIEWS)
2014/06/04 00:05:46
duplicates?
Aleksey Shlyapnikov
2014/06/04 02:02:47
Done.
| |
| 1003 {"type": "SHORT_EDGE"} | |
| 1004 ] | |
| 1005 }, | |
| 1006 "page_orientation": { | |
| 1007 "option": [ | |
| 1008 {"is_default": true, "type": "PORTRAIT"}, | |
| 1009 {"type": "LANDSCAPE"}, | |
| 1010 {"type": "AUTO"} | |
| 1011 ] | |
| 1012 } | |
| 1013 } | |
| 1014 } | |
| 728 }; | 1015 }; |
| 729 this.nativeLayer_.dispatchEvent(capsSetEvent); | 1016 this.nativeLayer_.dispatchEvent(capsSetEvent); |
| 730 | 1017 |
| 731 var previewGenerator = mock(print_preview.PreviewGenerator); | 1018 var previewGenerator = mock(print_preview.PreviewGenerator); |
| 732 printPreview.previewArea_.previewGenerator_ = previewGenerator.proxy(); | 1019 printPreview.previewArea_.previewGenerator_ = previewGenerator.proxy(); |
| 733 previewGenerator.expects(exactly(6)).requestPreview(); | 1020 previewGenerator.expects(exactly(6)).requestPreview(); |
| 734 | 1021 |
| 735 var barDestination; | 1022 var barDestination; |
| 736 var destinations = printPreview.destinationStore_.destinations(); | 1023 var destinations = printPreview.destinationStore_.destinations(); |
| 737 for (var destination, i = 0; destination = destinations[i]; i++) { | 1024 for (var destination, i = 0; destination = destinations[i]; i++) { |
| 738 if (destination.id == 'BarDevice') { | 1025 if (destination.id == 'BarDevice') { |
| 739 barDestination = destination; | 1026 barDestination = destination; |
| 740 break; | 1027 break; |
| 741 } | 1028 } |
| 742 } | 1029 } |
| 743 | 1030 |
| 744 printPreview.destinationStore_.selectDestination(barDestination); | 1031 printPreview.destinationStore_.selectDestination(barDestination); |
| 745 | 1032 |
| 746 var capsSetEvent = | 1033 var capsSetEvent = |
| 747 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); | 1034 new Event(print_preview.NativeLayer.EventType.CAPABILITIES_SET); |
| 748 capsSetEvent.settingsInfo = { | 1035 capsSetEvent.settingsInfo = { |
| 749 'printerId': 'BarDevice', | 1036 "printerId": "BarDevice", |
| 750 'disableColorOption': true, | 1037 "capabilities": { |
| 751 'setColorAsDefault': false, | 1038 "version": "1.0", |
| 752 'disableCopiesOption': true, | 1039 "printer": { |
| 753 'disableLandscapeOption': true, | 1040 "supported_content_type": [{"content_type": "application/pdf"}], |
| 754 'printerDefaultDuplexValue': 0 | 1041 "collate": {}, |
| 1042 "color": { | |
| 1043 "option": [ | |
| 1044 {"is_default": true, "type": "STANDARD_MONOCHROME"} | |
| 1045 ] | |
| 1046 }, | |
| 1047 "copies": {}, | |
| 1048 "duplex": { | |
| 1049 "option": [ | |
| 1050 {"is_default": true, "type": "NO_DUPLEX"}, | |
| 1051 {"type": "LONG_EDGE"}, | |
| 1052 {"type": "SHORT_EDGE"} | |
| 1053 ] | |
| 1054 }, | |
| 1055 "page_orientation": { | |
| 1056 "option": [ | |
| 1057 {"is_default": true, "type": "PORTRAIT"}, | |
| 1058 {"type": "LANDSCAPE"}, | |
| 1059 {"type": "AUTO"} | |
| 1060 ] | |
| 1061 } | |
| 1062 } | |
| 1063 } | |
| 755 }; | 1064 }; |
| 756 this.nativeLayer_.dispatchEvent(capsSetEvent); | 1065 this.nativeLayer_.dispatchEvent(capsSetEvent); |
| 757 }); | 1066 }); |
| 758 | 1067 |
| 759 // Test that error message is displayed when plugin doesn't exist. | 1068 // Test that error message is displayed when plugin doesn't exist. |
| 760 TEST_F('PrintPreviewWebUITest', 'TestNoPDFPluginErrorMessage', function() { | 1069 TEST_F('PrintPreviewWebUITest', 'TestNoPDFPluginErrorMessage', function() { |
| 761 var previewAreaEl = $('preview-area'); | 1070 var previewAreaEl = $('preview-area'); |
| 762 | 1071 |
| 763 var loadingMessageEl = | 1072 var loadingMessageEl = |
| 764 previewAreaEl.getElementsByClassName('preview-area-loading-message')[0]; | 1073 previewAreaEl.getElementsByClassName('preview-area-loading-message')[0]; |
| 765 expectEquals(true, loadingMessageEl.hidden); | 1074 expectEquals(true, loadingMessageEl.hidden); |
| 766 | 1075 |
| 767 var previewFailedMessageEl = previewAreaEl.getElementsByClassName( | 1076 var previewFailedMessageEl = previewAreaEl.getElementsByClassName( |
| 768 'preview-area-preview-failed-message')[0]; | 1077 'preview-area-preview-failed-message')[0]; |
| 769 expectEquals(true, previewFailedMessageEl.hidden); | 1078 expectEquals(true, previewFailedMessageEl.hidden); |
| 770 | 1079 |
| 771 var printFailedMessageEl = | 1080 var printFailedMessageEl = |
| 772 previewAreaEl.getElementsByClassName('preview-area-print-failed')[0]; | 1081 previewAreaEl.getElementsByClassName('preview-area-print-failed')[0]; |
| 773 expectEquals(true, printFailedMessageEl.hidden); | 1082 expectEquals(true, printFailedMessageEl.hidden); |
| 774 | 1083 |
| 775 var customMessageEl = | 1084 var customMessageEl = |
| 776 previewAreaEl.getElementsByClassName('preview-area-custom-message')[0]; | 1085 previewAreaEl.getElementsByClassName('preview-area-custom-message')[0]; |
| 777 expectEquals(false, customMessageEl.hidden); | 1086 expectEquals(false, customMessageEl.hidden); |
| 778 }); | 1087 }); |
| OLD | NEW |