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 virtual 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 } | 221 } |
222 | 222 |
223 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelperTestBase); | 223 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelperTestBase); |
224 }; | 224 }; |
225 | 225 |
226 class PrintWebViewHelperTest : public PrintWebViewHelperTestBase { | 226 class PrintWebViewHelperTest : public PrintWebViewHelperTestBase { |
227 public: | 227 public: |
228 PrintWebViewHelperTest() {} | 228 PrintWebViewHelperTest() {} |
229 virtual ~PrintWebViewHelperTest() {} | 229 virtual ~PrintWebViewHelperTest() {} |
230 | 230 |
231 virtual void SetUp() OVERRIDE { | 231 virtual void SetUp() override { |
232 ChromeRenderViewTest::SetUp(); | 232 ChromeRenderViewTest::SetUp(); |
233 } | 233 } |
234 | 234 |
235 protected: | 235 protected: |
236 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelperTest); | 236 DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelperTest); |
237 }; | 237 }; |
238 | 238 |
239 // This tests only for platforms without print preview. | 239 // This tests only for platforms without print preview. |
240 #if !defined(ENABLE_FULL_PRINTING) | 240 #if !defined(ENABLE_FULL_PRINTING) |
241 // Tests that the renderer blocks window.print() calls if they occur too | 241 // Tests that the renderer blocks window.print() calls if they occur too |
(...skipping 748 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 |