| OLD | NEW |
| 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 #include "chrome/common/chrome_switches.h" | 5 #include "chrome/common/chrome_switches.h" |
| 6 #include "chrome/common/print_messages.h" | 6 #include "chrome/common/print_messages.h" |
| 7 #include "chrome/renderer/print_web_view_helper.h" | 7 #include "chrome/renderer/print_web_view_helper.h" |
| 8 #include "chrome/test/base/render_view_test.h" | 8 #include "chrome/test/base/render_view_test.h" |
| 9 #include "printing/print_job_constants.h" | 9 #include "printing/print_job_constants.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 | 482 |
| 483 // Tests that printing from print preview fails and receiving error messages | 483 // Tests that printing from print preview fails and receiving error messages |
| 484 // through that channel all works. | 484 // through that channel all works. |
| 485 TEST_F(PrintWebViewHelperPreviewTest, OnPrintForPrintPreviewFail) { | 485 TEST_F(PrintWebViewHelperPreviewTest, OnPrintForPrintPreviewFail) { |
| 486 LoadHTML(kPrintPreviewHTML); | 486 LoadHTML(kPrintPreviewHTML); |
| 487 | 487 |
| 488 // An empty dictionary should fail. | 488 // An empty dictionary should fail. |
| 489 DictionaryValue empty_dict; | 489 DictionaryValue empty_dict; |
| 490 PrintWebViewHelper::Get(view_)->OnPrintForPrintPreview(empty_dict); | 490 PrintWebViewHelper::Get(view_)->OnPrintForPrintPreview(empty_dict); |
| 491 | 491 |
| 492 VerifyPrintFailed(true); | |
| 493 VerifyPagesPrinted(false); | 492 VerifyPagesPrinted(false); |
| 494 } | 493 } |
| 495 | 494 |
| 496 // Tests that when default printer has invalid printer settings, print preview | 495 // Tests that when default printer has invalid printer settings, print preview |
| 497 // receives error message. | 496 // receives error message. |
| 498 TEST_F(PrintWebViewHelperPreviewTest, | 497 TEST_F(PrintWebViewHelperPreviewTest, |
| 499 OnPrintPreviewUsingInvalidPrinterSettings) { | 498 OnPrintPreviewUsingInvalidPrinterSettings) { |
| 500 LoadHTML(kPrintPreviewHTML); | 499 LoadHTML(kPrintPreviewHTML); |
| 501 | 500 |
| 502 PrintWebViewHelper::Get(view_)->OnInitiatePrintPreview(); | 501 PrintWebViewHelper::Get(view_)->OnInitiatePrintPreview(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 523 LoadHTML(kPrintPreviewHTML); | 522 LoadHTML(kPrintPreviewHTML); |
| 524 | 523 |
| 525 // Set mock printer to provide invalid settings. | 524 // Set mock printer to provide invalid settings. |
| 526 render_thread_.printer()->UseInvalidSettings(); | 525 render_thread_.printer()->UseInvalidSettings(); |
| 527 | 526 |
| 528 // Fill in some dummy values. | 527 // Fill in some dummy values. |
| 529 DictionaryValue dict; | 528 DictionaryValue dict; |
| 530 CreatePrintSettingsDictionary(&dict); | 529 CreatePrintSettingsDictionary(&dict); |
| 531 PrintWebViewHelper::Get(view_)->OnPrintForPrintPreview(dict); | 530 PrintWebViewHelper::Get(view_)->OnPrintForPrintPreview(dict); |
| 532 | 531 |
| 532 VerifyPrintFailed(true); |
| 533 VerifyPagesPrinted(false); | 533 VerifyPagesPrinted(false); |
| 534 } | 534 } |
| 535 | 535 |
| 536 #endif // !defined(OS_CHROMEOS) | 536 #endif // !defined(OS_CHROMEOS) |
| OLD | NEW |