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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 // A simple web page with print page size css. | 45 // A simple web page with print page size css. |
46 const char kHTMLWithPageSizeCss[] = | 46 const char kHTMLWithPageSizeCss[] = |
47 "<html><head><style>" | 47 "<html><head><style>" |
48 "@media print {" | 48 "@media print {" |
49 " @page {" | 49 " @page {" |
50 " size: 4in 4in;" | 50 " size: 4in 4in;" |
51 " }" | 51 " }" |
52 "}" | 52 "}" |
53 "</style></head>" | 53 "</style></head>" |
54 "<body>Lorem Ipsum:<p>" | 54 "<body>Lorem Ipsum:" |
55 "</body></html>"; | 55 "</body></html>"; |
56 | 56 |
57 // A simple web page with print page layout css. | 57 // A simple web page with print page layout css. |
58 const char kHTMLWithLandscapePageCss[] = | 58 const char kHTMLWithLandscapePageCss[] = |
59 "<html><head><style>" | 59 "<html><head><style>" |
60 "@media print {" | 60 "@media print {" |
61 " @page {" | 61 " @page {" |
62 " size: landscape;" | 62 " size: landscape;" |
63 " }" | 63 " }" |
64 "}" | 64 "}" |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 TEST_F(PrintWebViewHelperPreviewTest, PrintPreviewShrinkToFitPage) { | 680 TEST_F(PrintWebViewHelperPreviewTest, PrintPreviewShrinkToFitPage) { |
681 // A simple web page with print margins css. | 681 // A simple web page with print margins css. |
682 const char kHTMLWithPageCss[] = | 682 const char kHTMLWithPageCss[] = |
683 "<html><head><style>" | 683 "<html><head><style>" |
684 "@media print {" | 684 "@media print {" |
685 " @page {" | 685 " @page {" |
686 " size: 15in 17in;" | 686 " size: 15in 17in;" |
687 " }" | 687 " }" |
688 "}" | 688 "}" |
689 "</style></head>" | 689 "</style></head>" |
690 "<body>Lorem Ipsum:<p>" | 690 "<body>Lorem Ipsum:" |
691 "</body></html>"; | 691 "</body></html>"; |
692 LoadHTML(kHTMLWithPageCss); | 692 LoadHTML(kHTMLWithPageCss); |
693 | 693 |
694 // Fill in some dummy values. | 694 // Fill in some dummy values. |
695 base::DictionaryValue dict; | 695 base::DictionaryValue dict; |
696 CreatePrintSettingsDictionary(&dict); | 696 CreatePrintSettingsDictionary(&dict); |
697 dict.SetBoolean(kSettingPrintToPDF, false); | 697 dict.SetBoolean(kSettingPrintToPDF, false); |
698 dict.SetInteger(kSettingMarginsType, DEFAULT_MARGINS); | 698 dict.SetInteger(kSettingMarginsType, DEFAULT_MARGINS); |
699 OnPrintPreview(dict); | 699 OnPrintPreview(dict); |
700 | 700 |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 chrome_render_thread_->printer()->ResetPrinter(); | 969 chrome_render_thread_->printer()->ResetPrinter(); |
970 VerifyPagesPrinted(false); | 970 VerifyPagesPrinted(false); |
971 | 971 |
972 // Pretend user will print, should not be throttled. | 972 // Pretend user will print, should not be throttled. |
973 chrome_render_thread_->set_print_dialog_user_response(true); | 973 chrome_render_thread_->set_print_dialog_user_response(true); |
974 PrintWithJavaScript(); | 974 PrintWithJavaScript(); |
975 VerifyPagesPrinted(true); | 975 VerifyPagesPrinted(true); |
976 } | 976 } |
977 | 977 |
978 } // namespace printing | 978 } // namespace printing |
OLD | NEW |