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 "chrome/common/chrome_switches.h" | 7 #include "chrome/common/chrome_switches.h" |
8 #include "chrome/common/print_messages.h" | 8 #include "chrome/common/print_messages.h" |
9 #include "chrome/renderer/printing/mock_printer.h" | 9 #include "chrome/renderer/printing/mock_printer.h" |
10 #include "chrome/renderer/printing/print_web_view_helper.h" | 10 #include "chrome/renderer/printing/print_web_view_helper.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 dict->SetBoolean(kSettingShouldPrintBackgrounds, false); | 103 dict->SetBoolean(kSettingShouldPrintBackgrounds, false); |
104 dict->SetBoolean(kSettingShouldPrintSelectionOnly, false); | 104 dict->SetBoolean(kSettingShouldPrintSelectionOnly, false); |
105 } | 105 } |
106 #endif // !defined(OS_CHROMEOS) | 106 #endif // !defined(OS_CHROMEOS) |
107 | 107 |
108 class DidPreviewPageListener : public IPC::Listener { | 108 class DidPreviewPageListener : public IPC::Listener { |
109 public: | 109 public: |
110 explicit DidPreviewPageListener(base::RunLoop* run_loop) | 110 explicit DidPreviewPageListener(base::RunLoop* run_loop) |
111 : run_loop_(run_loop) {} | 111 : run_loop_(run_loop) {} |
112 | 112 |
113 virtual bool OnMessageReceived(const IPC::Message& message) override { | 113 bool OnMessageReceived(const IPC::Message& message) override { |
114 if (message.type() == PrintHostMsg_MetafileReadyForPrinting::ID || | 114 if (message.type() == PrintHostMsg_MetafileReadyForPrinting::ID || |
115 message.type() == PrintHostMsg_PrintPreviewFailed::ID || | 115 message.type() == PrintHostMsg_PrintPreviewFailed::ID || |
116 message.type() == PrintHostMsg_PrintPreviewCancelled::ID) | 116 message.type() == PrintHostMsg_PrintPreviewCancelled::ID) |
117 run_loop_->Quit(); | 117 run_loop_->Quit(); |
118 return false; | 118 return false; |
119 } | 119 } |
120 | 120 |
121 private: | 121 private: |
122 base::RunLoop* const run_loop_; | 122 base::RunLoop* const run_loop_; |
123 DISALLOW_COPY_AND_ASSIGN(DidPreviewPageListener); | 123 DISALLOW_COPY_AND_ASSIGN(DidPreviewPageListener); |
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 CreatePrintSettingsDictionary(&dict); | 990 CreatePrintSettingsDictionary(&dict); |
991 OnPrintForPrintPreview(dict); | 991 OnPrintForPrintPreview(dict); |
992 | 992 |
993 VerifyPrintFailed(true); | 993 VerifyPrintFailed(true); |
994 VerifyPagesPrinted(false); | 994 VerifyPagesPrinted(false); |
995 } | 995 } |
996 | 996 |
997 #endif // !defined(OS_CHROMEOS) | 997 #endif // !defined(OS_CHROMEOS) |
998 | 998 |
999 } // namespace printing | 999 } // namespace printing |
OLD | NEW |