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 22 matching lines...) Expand all Loading... |
33 const char kLongPageHTML[] = | 33 const char kLongPageHTML[] = |
34 "<body><img src=\"\" width=10 height=10000 /></body>"; | 34 "<body><img src=\"\" width=10 height=10000 /></body>"; |
35 | 35 |
36 // A web page to simulate the print preview page. | 36 // A web page to simulate the print preview page. |
37 const char kPrintPreviewHTML[] = | 37 const char kPrintPreviewHTML[] = |
38 "<body><p id=\"pdf-viewer\">Hello World!</p></body>"; | 38 "<body><p id=\"pdf-viewer\">Hello World!</p></body>"; |
39 | 39 |
40 void CreatePrintSettingsDictionary(DictionaryValue* dict) { | 40 void CreatePrintSettingsDictionary(DictionaryValue* dict) { |
41 dict->SetBoolean(printing::kSettingLandscape, false); | 41 dict->SetBoolean(printing::kSettingLandscape, false); |
42 dict->SetBoolean(printing::kSettingCollate, false); | 42 dict->SetBoolean(printing::kSettingCollate, false); |
43 dict->SetBoolean(printing::kSettingColor, false); | 43 dict->SetInteger(printing::kSettingColor, printing::GRAY); |
44 dict->SetBoolean(printing::kSettingPrintToPDF, true); | 44 dict->SetBoolean(printing::kSettingPrintToPDF, true); |
45 dict->SetInteger(printing::kSettingDuplexMode, printing::SIMPLEX); | 45 dict->SetInteger(printing::kSettingDuplexMode, printing::SIMPLEX); |
46 dict->SetInteger(printing::kSettingCopies, 1); | 46 dict->SetInteger(printing::kSettingCopies, 1); |
47 dict->SetString(printing::kSettingDeviceName, "dummy"); | 47 dict->SetString(printing::kSettingDeviceName, "dummy"); |
48 dict->SetString(printing::kPreviewUIAddr, "0xb33fbeef"); | 48 dict->SetString(printing::kPreviewUIAddr, "0xb33fbeef"); |
49 dict->SetInteger(printing::kPreviewRequestID, 12345); | 49 dict->SetInteger(printing::kPreviewRequestID, 12345); |
50 dict->SetBoolean(printing::kIsFirstRequest, true); | 50 dict->SetBoolean(printing::kIsFirstRequest, true); |
51 dict->SetBoolean(printing::kSettingDefaultMarginsSelected, true); | 51 dict->SetBoolean(printing::kSettingDefaultMarginsSelected, true); |
52 dict->SetBoolean(printing::kSettingHeaderFooterEnabled, false); | 52 dict->SetBoolean(printing::kSettingHeaderFooterEnabled, false); |
53 dict->SetBoolean(printing::kSettingGenerateDraftData, true); | 53 dict->SetBoolean(printing::kSettingGenerateDraftData, true); |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 | 527 |
528 // Fill in some dummy values. | 528 // Fill in some dummy values. |
529 DictionaryValue dict; | 529 DictionaryValue dict; |
530 CreatePrintSettingsDictionary(&dict); | 530 CreatePrintSettingsDictionary(&dict); |
531 PrintWebViewHelper::Get(view_)->OnPrintForPrintPreview(dict); | 531 PrintWebViewHelper::Get(view_)->OnPrintForPrintPreview(dict); |
532 | 532 |
533 VerifyPagesPrinted(false); | 533 VerifyPagesPrinted(false); |
534 } | 534 } |
535 | 535 |
536 #endif // !defined(OS_CHROMEOS) | 536 #endif // !defined(OS_CHROMEOS) |
OLD | NEW |