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 "chrome/common/chrome_switches.h" | 6 #include "chrome/common/chrome_switches.h" |
7 #include "chrome/common/print_messages.h" | 7 #include "chrome/common/print_messages.h" |
8 #include "chrome/renderer/mock_printer.h" | 8 #include "chrome/renderer/mock_printer.h" |
9 #include "chrome/renderer/print_web_view_helper.h" | 9 #include "chrome/renderer/print_web_view_helper.h" |
10 #include "chrome/test/base/chrome_render_view_test.h" | 10 #include "chrome/test/base/chrome_render_view_test.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 VerifyPagesPrinted(false); | 216 VerifyPagesPrinted(false); |
217 | 217 |
218 // Pretend user will print. (but printing is blocked.) | 218 // Pretend user will print. (but printing is blocked.) |
219 chrome_render_thread_->set_print_dialog_user_response(true); | 219 chrome_render_thread_->set_print_dialog_user_response(true); |
220 LoadHTML(kPrintWithJSHTML); | 220 LoadHTML(kPrintWithJSHTML); |
221 VerifyPagesPrinted(false); | 221 VerifyPagesPrinted(false); |
222 | 222 |
223 // Try again as if user initiated, without resetting the print count. | 223 // Try again as if user initiated, without resetting the print count. |
224 chrome_render_thread_->printer()->ResetPrinter(); | 224 chrome_render_thread_->printer()->ResetPrinter(); |
225 LoadHTML(kPrintOnUserAction); | 225 LoadHTML(kPrintOnUserAction); |
226 gfx::Size new_size(200,100); | 226 gfx::Size new_size(200, 100); |
227 Resize(new_size, gfx::Rect(), false); | 227 Resize(new_size, gfx::Rect(), false); |
228 | 228 |
229 gfx::Rect bounds = GetElementBounds("print"); | 229 gfx::Rect bounds = GetElementBounds("print"); |
230 EXPECT_FALSE(bounds.IsEmpty()); | 230 EXPECT_FALSE(bounds.IsEmpty()); |
231 WebKit::WebMouseEvent mouse_event; | 231 WebKit::WebMouseEvent mouse_event; |
232 mouse_event.type = WebKit::WebInputEvent::MouseDown; | 232 mouse_event.type = WebKit::WebInputEvent::MouseDown; |
233 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; | 233 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; |
234 mouse_event.x = bounds.CenterPoint().x(); | 234 mouse_event.x = bounds.CenterPoint().x(); |
235 mouse_event.y = bounds.CenterPoint().y(); | 235 mouse_event.y = bounds.CenterPoint().y(); |
236 mouse_event.clickCount = 1; | 236 mouse_event.clickCount = 1; |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 chrome_render_thread_->printer()->ResetPrinter(); | 906 chrome_render_thread_->printer()->ResetPrinter(); |
907 LoadHTML(kPrintWithJSHTML); | 907 LoadHTML(kPrintWithJSHTML); |
908 chrome_render_thread_->printer()->ResetPrinter(); | 908 chrome_render_thread_->printer()->ResetPrinter(); |
909 VerifyPagesPrinted(false); | 909 VerifyPagesPrinted(false); |
910 | 910 |
911 // Pretend user will print, should not be throttled. | 911 // Pretend user will print, should not be throttled. |
912 chrome_render_thread_->set_print_dialog_user_response(true); | 912 chrome_render_thread_->set_print_dialog_user_response(true); |
913 LoadHTML(kPrintWithJSHTML); | 913 LoadHTML(kPrintWithJSHTML); |
914 VerifyPagesPrinted(true); | 914 VerifyPagesPrinted(true); |
915 } | 915 } |
OLD | NEW |