| 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 "components/printing/renderer/print_web_view_helper.h" | 5 #include "components/printing/renderer/print_web_view_helper.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <tuple> | 10 #include <tuple> |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 VerifyPagesPrinted(false); | 333 VerifyPagesPrinted(false); |
| 334 | 334 |
| 335 // Try again as if user initiated, without resetting the print count. | 335 // Try again as if user initiated, without resetting the print count. |
| 336 print_render_thread_->printer()->ResetPrinter(); | 336 print_render_thread_->printer()->ResetPrinter(); |
| 337 LoadHTML(kPrintOnUserAction); | 337 LoadHTML(kPrintOnUserAction); |
| 338 gfx::Size new_size(200, 100); | 338 gfx::Size new_size(200, 100); |
| 339 Resize(new_size, false); | 339 Resize(new_size, false); |
| 340 | 340 |
| 341 gfx::Rect bounds = GetElementBounds("print"); | 341 gfx::Rect bounds = GetElementBounds("print"); |
| 342 EXPECT_FALSE(bounds.IsEmpty()); | 342 EXPECT_FALSE(bounds.IsEmpty()); |
| 343 blink::WebMouseEvent mouse_event; | 343 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, |
| 344 mouse_event.type = blink::WebInputEvent::MouseDown; | 344 blink::WebInputEvent::NoModifiers, |
| 345 blink::WebInputEvent::TimeStampForTesting); |
| 345 mouse_event.button = blink::WebMouseEvent::Button::Left; | 346 mouse_event.button = blink::WebMouseEvent::Button::Left; |
| 346 mouse_event.x = bounds.CenterPoint().x(); | 347 mouse_event.x = bounds.CenterPoint().x(); |
| 347 mouse_event.y = bounds.CenterPoint().y(); | 348 mouse_event.y = bounds.CenterPoint().y(); |
| 348 mouse_event.clickCount = 1; | 349 mouse_event.clickCount = 1; |
| 349 SendWebMouseEvent(mouse_event); | 350 SendWebMouseEvent(mouse_event); |
| 350 mouse_event.type = blink::WebInputEvent::MouseUp; | 351 mouse_event.setType(blink::WebInputEvent::MouseUp); |
| 351 SendWebMouseEvent(mouse_event); | 352 SendWebMouseEvent(mouse_event); |
| 352 ProcessPendingMessages(); | 353 ProcessPendingMessages(); |
| 353 | 354 |
| 354 VerifyPageCount(1); | 355 VerifyPageCount(1); |
| 355 VerifyPagesPrinted(true); | 356 VerifyPagesPrinted(true); |
| 356 } | 357 } |
| 357 | 358 |
| 358 // Duplicate of OnPrintPagesTest only using javascript to print. | 359 // Duplicate of OnPrintPagesTest only using javascript to print. |
| 359 TEST_F(MAYBE_PrintWebViewHelperTest, PrintWithJavascript) { | 360 TEST_F(MAYBE_PrintWebViewHelperTest, PrintWithJavascript) { |
| 360 PrintWithJavaScript(); | 361 PrintWithJavaScript(); |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 | 1062 |
| 1062 VerifyPrintFailed(true); | 1063 VerifyPrintFailed(true); |
| 1063 VerifyPagesPrinted(false); | 1064 VerifyPagesPrinted(false); |
| 1064 } | 1065 } |
| 1065 #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) | 1066 #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) |
| 1066 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) | 1067 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) |
| 1067 | 1068 |
| 1068 #endif // !defined(OS_CHROMEOS) | 1069 #endif // !defined(OS_CHROMEOS) |
| 1069 | 1070 |
| 1070 } // namespace printing | 1071 } // namespace printing |
| OLD | NEW |