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/render_view_test.h" | 8 #include "chrome/test/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 23 matching lines...) Expand all Loading... |
34 "<body><p id=\"pdf-viewer\">Hello World!</p></body>"; | 34 "<body><p id=\"pdf-viewer\">Hello World!</p></body>"; |
35 | 35 |
36 void CreatePrintSettingsDictionary(DictionaryValue* dict) { | 36 void CreatePrintSettingsDictionary(DictionaryValue* dict) { |
37 dict->SetBoolean(printing::kSettingLandscape, false); | 37 dict->SetBoolean(printing::kSettingLandscape, false); |
38 dict->SetBoolean(printing::kSettingCollate, false); | 38 dict->SetBoolean(printing::kSettingCollate, false); |
39 dict->SetBoolean(printing::kSettingColor, false); | 39 dict->SetBoolean(printing::kSettingColor, false); |
40 dict->SetBoolean(printing::kSettingPrintToPDF, true); | 40 dict->SetBoolean(printing::kSettingPrintToPDF, true); |
41 dict->SetInteger(printing::kSettingDuplexMode, printing::SIMPLEX); | 41 dict->SetInteger(printing::kSettingDuplexMode, printing::SIMPLEX); |
42 dict->SetInteger(printing::kSettingCopies, 1); | 42 dict->SetInteger(printing::kSettingCopies, 1); |
43 dict->SetString(printing::kSettingDeviceName, "dummy"); | 43 dict->SetString(printing::kSettingDeviceName, "dummy"); |
| 44 dict->SetInteger(printing::kPreviewRequestID, 12345); |
44 } | 45 } |
45 | 46 |
46 } // namespace | 47 } // namespace |
47 | 48 |
48 class PrintWebViewHelperTestBase : public RenderViewTest { | 49 class PrintWebViewHelperTestBase : public RenderViewTest { |
49 public: | 50 public: |
50 PrintWebViewHelperTestBase() {} | 51 PrintWebViewHelperTestBase() {} |
51 ~PrintWebViewHelperTestBase() {} | 52 ~PrintWebViewHelperTestBase() {} |
52 | 53 |
53 protected: | 54 protected: |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 LoadHTML(kPrintPreviewHTML); | 417 LoadHTML(kPrintPreviewHTML); |
417 | 418 |
418 // An empty dictionary should fail. | 419 // An empty dictionary should fail. |
419 DictionaryValue empty_dict; | 420 DictionaryValue empty_dict; |
420 PrintWebViewHelper::Get(view_)->OnPrintForPrintPreview(empty_dict); | 421 PrintWebViewHelper::Get(view_)->OnPrintForPrintPreview(empty_dict); |
421 | 422 |
422 VerifyPrintFailed(true); | 423 VerifyPrintFailed(true); |
423 VerifyPagesPrinted(false); | 424 VerifyPagesPrinted(false); |
424 } | 425 } |
425 #endif // !defined(OS_CHROMEOS) | 426 #endif // !defined(OS_CHROMEOS) |
OLD | NEW |