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 "components/printing/common/print_messages.h" | 7 #include "components/printing/common/print_messages.h" |
8 #include "components/printing/renderer/print_web_view_helper.h" | 8 #include "components/printing/renderer/print_web_view_helper.h" |
9 #include "components/printing/test/mock_printer.h" | 9 #include "components/printing/test/mock_printer.h" |
10 #include "components/printing/test/print_mock_render_thread.h" | 10 #include "components/printing/test/print_mock_render_thread.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 void PrintWithJavaScript() { | 155 void PrintWithJavaScript() { |
156 ExecuteJavaScript("window.print();"); | 156 ExecuteJavaScript("window.print();"); |
157 ProcessPendingMessages(); | 157 ProcessPendingMessages(); |
158 } | 158 } |
159 // The renderer should be done calculating the number of rendered pages | 159 // The renderer should be done calculating the number of rendered pages |
160 // according to the specified settings defined in the mock render thread. | 160 // according to the specified settings defined in the mock render thread. |
161 // Verify the page count is correct. | 161 // Verify the page count is correct. |
162 void VerifyPageCount(int count) { | 162 void VerifyPageCount(int count) { |
163 #if defined(OS_CHROMEOS) | 163 #if defined(OS_CHROMEOS) |
164 // The DidGetPrintedPagesCount message isn't sent on ChromeOS. Right now we | 164 // The DidGetPrintedPagesCount message isn't sent on ChromeOS. Right now we |
165 // always print all pages, and there are checks to that effect built into | 165 // always print all pages, and there are checks to that effect built into |
166 // the print code. | 166 // the print code. |
167 #else | 167 #else |
168 const IPC::Message* page_cnt_msg = | 168 const IPC::Message* page_cnt_msg = |
169 render_thread_->sink().GetUniqueMessageMatching( | 169 render_thread_->sink().GetUniqueMessageMatching( |
170 PrintHostMsg_DidGetPrintedPagesCount::ID); | 170 PrintHostMsg_DidGetPrintedPagesCount::ID); |
171 ASSERT_TRUE(page_cnt_msg); | 171 ASSERT_TRUE(page_cnt_msg); |
172 PrintHostMsg_DidGetPrintedPagesCount::Param post_page_count_param; | 172 PrintHostMsg_DidGetPrintedPagesCount::Param post_page_count_param; |
173 PrintHostMsg_DidGetPrintedPagesCount::Read(page_cnt_msg, | 173 PrintHostMsg_DidGetPrintedPagesCount::Read(page_cnt_msg, |
174 &post_page_count_param); | 174 &post_page_count_param); |
175 EXPECT_EQ(count, get<1>(post_page_count_param)); | 175 EXPECT_EQ(count, get<1>(post_page_count_param)); |
176 #endif // defined(OS_CHROMEOS) | 176 #endif // defined(OS_CHROMEOS) |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 CreatePrintSettingsDictionary(&dict); | 1018 CreatePrintSettingsDictionary(&dict); |
1019 OnPrintForPrintPreview(dict); | 1019 OnPrintForPrintPreview(dict); |
1020 | 1020 |
1021 VerifyPrintFailed(true); | 1021 VerifyPrintFailed(true); |
1022 VerifyPagesPrinted(false); | 1022 VerifyPagesPrinted(false); |
1023 } | 1023 } |
1024 | 1024 |
1025 #endif // !defined(OS_CHROMEOS) | 1025 #endif // !defined(OS_CHROMEOS) |
1026 | 1026 |
1027 } // namespace printing | 1027 } // namespace printing |
OLD | NEW |