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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 LoadHTML(kPrintOnUserAction); | 352 LoadHTML(kPrintOnUserAction); |
353 gfx::Size new_size(200, 100); | 353 gfx::Size new_size(200, 100); |
354 Resize(new_size, false); | 354 Resize(new_size, false); |
355 | 355 |
356 gfx::Rect bounds = GetElementBounds("print"); | 356 gfx::Rect bounds = GetElementBounds("print"); |
357 EXPECT_FALSE(bounds.IsEmpty()); | 357 EXPECT_FALSE(bounds.IsEmpty()); |
358 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, | 358 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, |
359 blink::WebInputEvent::NoModifiers, | 359 blink::WebInputEvent::NoModifiers, |
360 blink::WebInputEvent::TimeStampForTesting); | 360 blink::WebInputEvent::TimeStampForTesting); |
361 mouse_event.button = blink::WebMouseEvent::Button::Left; | 361 mouse_event.button = blink::WebMouseEvent::Button::Left; |
362 mouse_event.x = bounds.CenterPoint().x(); | 362 mouse_event.setPositionInWidget(bounds.CenterPoint().x(), |
363 mouse_event.y = bounds.CenterPoint().y(); | 363 bounds.CenterPoint().y()); |
364 mouse_event.clickCount = 1; | 364 mouse_event.clickCount = 1; |
365 SendWebMouseEvent(mouse_event); | 365 SendWebMouseEvent(mouse_event); |
366 mouse_event.setType(blink::WebInputEvent::MouseUp); | 366 mouse_event.setType(blink::WebInputEvent::MouseUp); |
367 SendWebMouseEvent(mouse_event); | 367 SendWebMouseEvent(mouse_event); |
368 ProcessPendingMessages(); | 368 ProcessPendingMessages(); |
369 | 369 |
370 VerifyPageCount(1); | 370 VerifyPageCount(1); |
371 VerifyPagesPrinted(true); | 371 VerifyPagesPrinted(true); |
372 } | 372 } |
373 | 373 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 LoadHTML(kPrintOnUserAction); | 659 LoadHTML(kPrintOnUserAction); |
660 gfx::Size new_size(200, 100); | 660 gfx::Size new_size(200, 100); |
661 Resize(new_size, false); | 661 Resize(new_size, false); |
662 | 662 |
663 gfx::Rect bounds = GetElementBounds("print"); | 663 gfx::Rect bounds = GetElementBounds("print"); |
664 EXPECT_FALSE(bounds.IsEmpty()); | 664 EXPECT_FALSE(bounds.IsEmpty()); |
665 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, | 665 blink::WebMouseEvent mouse_event(blink::WebInputEvent::MouseDown, |
666 blink::WebInputEvent::NoModifiers, | 666 blink::WebInputEvent::NoModifiers, |
667 blink::WebInputEvent::TimeStampForTesting); | 667 blink::WebInputEvent::TimeStampForTesting); |
668 mouse_event.button = blink::WebMouseEvent::Button::Left; | 668 mouse_event.button = blink::WebMouseEvent::Button::Left; |
669 mouse_event.x = bounds.CenterPoint().x(); | 669 mouse_event.setPositionInWidget(bounds.CenterPoint().x(), |
670 mouse_event.y = bounds.CenterPoint().y(); | 670 bounds.CenterPoint().y()); |
671 mouse_event.clickCount = 1; | 671 mouse_event.clickCount = 1; |
672 SendWebMouseEvent(mouse_event); | 672 SendWebMouseEvent(mouse_event); |
673 mouse_event.setType(blink::WebInputEvent::MouseUp); | 673 mouse_event.setType(blink::WebInputEvent::MouseUp); |
674 SendWebMouseEvent(mouse_event); | 674 SendWebMouseEvent(mouse_event); |
675 | 675 |
676 VerifyPreviewRequest(true); | 676 VerifyPreviewRequest(true); |
677 } | 677 } |
678 | 678 |
679 // Tests that print preview work and sending and receiving messages through | 679 // Tests that print preview work and sending and receiving messages through |
680 // that channel all works. | 680 // that channel all works. |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 | 1112 |
1113 VerifyPrintFailed(true); | 1113 VerifyPrintFailed(true); |
1114 VerifyPagesPrinted(false); | 1114 VerifyPagesPrinted(false); |
1115 } | 1115 } |
1116 #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) | 1116 #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) |
1117 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) | 1117 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) |
1118 | 1118 |
1119 #endif // !defined(OS_CHROMEOS) | 1119 #endif // !defined(OS_CHROMEOS) |
1120 | 1120 |
1121 } // namespace printing | 1121 } // namespace printing |
OLD | NEW |