| 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 "base/run_loop.h" | 6 #include "base/run_loop.h" |
| 7 #include "components/printing/common/print_messages.h" | 7 #include "components/printing/common/print_messages.h" |
| 8 #include "components/printing/renderer/print_web_view_helper.h" | 8 #include "components/printing/renderer/print_web_view_helper.h" |
| 9 #include "components/printing/test/mock_printer.h" | 9 #include "components/printing/test/mock_printer.h" |
| 10 #include "components/printing/test/print_mock_render_thread.h" | 10 #include "components/printing/test/print_mock_render_thread.h" |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 // Test cases used in this test. | 397 // Test cases used in this test. |
| 398 struct TestPageData { | 398 struct TestPageData { |
| 399 const char* page; | 399 const char* page; |
| 400 size_t printed_pages; | 400 size_t printed_pages; |
| 401 int width; | 401 int width; |
| 402 int height; | 402 int height; |
| 403 const char* checksum; | 403 const char* checksum; |
| 404 const wchar_t* file; | 404 const wchar_t* file; |
| 405 }; | 405 }; |
| 406 | 406 |
| 407 #if defined(OS_WIN) || defined(OS_MACOSX) | 407 #if defined(OS_MACOSX) && defined(ENABLE_BASIC_PRINTING) |
| 408 const TestPageData kTestPages[] = { | 408 const TestPageData kTestPages[] = { |
| 409 { | 409 { |
| 410 "<html>" | 410 "<html>" |
| 411 "<head>" | 411 "<head>" |
| 412 "<meta" | 412 "<meta" |
| 413 " http-equiv=\"Content-Type\"" | 413 " http-equiv=\"Content-Type\"" |
| 414 " content=\"text/html; charset=utf-8\"/>" | 414 " content=\"text/html; charset=utf-8\"/>" |
| 415 "<title>Test 1</title>" | 415 "<title>Test 1</title>" |
| 416 "</head>" | 416 "</head>" |
| 417 "<body style=\"background-color: white;\">" | 417 "<body style=\"background-color: white;\">" |
| 418 "<p style=\"font-family: arial;\">Hello World!</p>" | 418 "<p style=\"font-family: arial;\">Hello World!</p>" |
| 419 "</body>", | 419 "</body>", |
| 420 #if defined(OS_MACOSX) | 420 1, |
| 421 // Mac printing code compensates for the WebKit scale factor while | 421 // Mac printing code compensates for the WebKit scale factor while |
| 422 // generating | 422 // generating the metafile, so we expect smaller pages. (On non-Mac |
| 423 // the metafile, so we expect smaller pages. | 423 // platforms, this would be 675x900). |
| 424 1, | |
| 425 600, | 424 600, |
| 426 780, | 425 780, |
| 427 #else | |
| 428 1, | |
| 429 675, | |
| 430 900, | |
| 431 #endif | |
| 432 NULL, | 426 NULL, |
| 433 NULL, | 427 NULL, |
| 434 }, | 428 }, |
| 435 }; | 429 }; |
| 436 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 430 #endif // defined(OS_MACOSX) && defined(ENABLE_BASIC_PRINTING) |
| 437 } // namespace | 431 } // namespace |
| 438 | 432 |
| 439 // TODO(estade): need to port MockPrinter to get this on Linux. This involves | 433 // TODO(estade): need to port MockPrinter to get this on Linux. This involves |
| 440 // hooking up Cairo to read a pdf stream, or accessing the cairo surface in the | 434 // hooking up Cairo to read a pdf stream, or accessing the cairo surface in the |
| 441 // metafile directly. | 435 // metafile directly. |
| 442 // Same for printing via PDF on Windows. | 436 // Same for printing via PDF on Windows. |
| 443 #if defined(OS_MACOSX) && defined(ENABLE_BASIC_PRINTING) | 437 #if defined(OS_MACOSX) && defined(ENABLE_BASIC_PRINTING) |
| 444 TEST_F(MAYBE_PrintWebViewHelperTest, PrintLayoutTest) { | 438 TEST_F(MAYBE_PrintWebViewHelperTest, PrintLayoutTest) { |
| 445 bool baseline = false; | 439 bool baseline = false; |
| 446 | 440 |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 CreatePrintSettingsDictionary(&dict); | 1029 CreatePrintSettingsDictionary(&dict); |
| 1036 OnPrintForPrintPreview(dict); | 1030 OnPrintForPrintPreview(dict); |
| 1037 | 1031 |
| 1038 VerifyPrintFailed(true); | 1032 VerifyPrintFailed(true); |
| 1039 VerifyPagesPrinted(false); | 1033 VerifyPagesPrinted(false); |
| 1040 } | 1034 } |
| 1041 | 1035 |
| 1042 #endif // !defined(OS_CHROMEOS) | 1036 #endif // !defined(OS_CHROMEOS) |
| 1043 | 1037 |
| 1044 } // namespace printing | 1038 } // namespace printing |
| OLD | NEW |