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 #include "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "chrome/common/chrome_switches.h" | 6 #include "chrome/common/chrome_switches.h" |
7 #include "chrome/common/print_messages.h" | 7 #include "chrome/common/print_messages.h" |
8 #include "chrome/renderer/mock_printer.h" | 8 #include "chrome/renderer/mock_printer.h" |
9 #include "chrome/renderer/printing/print_web_view_helper.h" | 9 #include "chrome/renderer/printing/print_web_view_helper.h" |
10 #include "chrome/test/base/chrome_render_view_test.h" | 10 #include "chrome/test/base/chrome_render_view_test.h" |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 std::string bitmap_actual; | 415 std::string bitmap_actual; |
416 EXPECT_TRUE( | 416 EXPECT_TRUE( |
417 chrome_render_thread_->printer()->GetBitmapChecksum(0, &bitmap_actual)); | 417 chrome_render_thread_->printer()->GetBitmapChecksum(0, &bitmap_actual)); |
418 if (kTestPages[i].checksum) | 418 if (kTestPages[i].checksum) |
419 EXPECT_EQ(kTestPages[i].checksum, bitmap_actual); | 419 EXPECT_EQ(kTestPages[i].checksum, bitmap_actual); |
420 | 420 |
421 if (baseline) { | 421 if (baseline) { |
422 // Save the source data and the bitmap data into temporary files to | 422 // Save the source data and the bitmap data into temporary files to |
423 // create base-line results. | 423 // create base-line results. |
424 base::FilePath source_path; | 424 base::FilePath source_path; |
425 file_util::CreateTemporaryFile(&source_path); | 425 base::CreateTemporaryFile(&source_path); |
426 chrome_render_thread_->printer()->SaveSource(0, source_path); | 426 chrome_render_thread_->printer()->SaveSource(0, source_path); |
427 | 427 |
428 base::FilePath bitmap_path; | 428 base::FilePath bitmap_path; |
429 file_util::CreateTemporaryFile(&bitmap_path); | 429 base::CreateTemporaryFile(&bitmap_path); |
430 chrome_render_thread_->printer()->SaveBitmap(0, bitmap_path); | 430 chrome_render_thread_->printer()->SaveBitmap(0, bitmap_path); |
431 } | 431 } |
432 } | 432 } |
433 } | 433 } |
434 #endif | 434 #endif |
435 | 435 |
436 // These print preview tests do not work on Chrome OS yet. | 436 // These print preview tests do not work on Chrome OS yet. |
437 #if !defined(OS_CHROMEOS) | 437 #if !defined(OS_CHROMEOS) |
438 class PrintWebViewHelperPreviewTest : public PrintWebViewHelperTestBase { | 438 class PrintWebViewHelperPreviewTest : public PrintWebViewHelperTestBase { |
439 public: | 439 public: |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 chrome_render_thread_->printer()->ResetPrinter(); | 971 chrome_render_thread_->printer()->ResetPrinter(); |
972 VerifyPagesPrinted(false); | 972 VerifyPagesPrinted(false); |
973 | 973 |
974 // Pretend user will print, should not be throttled. | 974 // Pretend user will print, should not be throttled. |
975 chrome_render_thread_->set_print_dialog_user_response(true); | 975 chrome_render_thread_->set_print_dialog_user_response(true); |
976 PrintWithJavaScript(); | 976 PrintWithJavaScript(); |
977 VerifyPagesPrinted(true); | 977 VerifyPagesPrinted(true); |
978 } | 978 } |
979 | 979 |
980 } // namespace printing | 980 } // namespace printing |
OLD | NEW |