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 "content/shell/renderer/layout_test/blink_test_runner.h" | 5 #include "content/shell/renderer/layout_test/blink_test_runner.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <clocale> | 10 #include <clocale> |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 bool handled = true; | 815 bool handled = true; |
816 IPC_BEGIN_MESSAGE_MAP(BlinkTestRunner, message) | 816 IPC_BEGIN_MESSAGE_MAP(BlinkTestRunner, message) |
817 IPC_MESSAGE_HANDLER(ShellViewMsg_SessionHistory, OnSessionHistory) | 817 IPC_MESSAGE_HANDLER(ShellViewMsg_SessionHistory, OnSessionHistory) |
818 IPC_MESSAGE_HANDLER(ShellViewMsg_Reset, OnReset) | 818 IPC_MESSAGE_HANDLER(ShellViewMsg_Reset, OnReset) |
819 IPC_MESSAGE_HANDLER(ShellViewMsg_TestFinishedInSecondaryRenderer, | 819 IPC_MESSAGE_HANDLER(ShellViewMsg_TestFinishedInSecondaryRenderer, |
820 OnTestFinishedInSecondaryRenderer) | 820 OnTestFinishedInSecondaryRenderer) |
821 IPC_MESSAGE_HANDLER(ShellViewMsg_TryLeakDetection, OnTryLeakDetection) | 821 IPC_MESSAGE_HANDLER(ShellViewMsg_TryLeakDetection, OnTryLeakDetection) |
822 IPC_MESSAGE_HANDLER(ShellViewMsg_ReplyBluetoothManualChooserEvents, | 822 IPC_MESSAGE_HANDLER(ShellViewMsg_ReplyBluetoothManualChooserEvents, |
823 OnReplyBluetoothManualChooserEvents) | 823 OnReplyBluetoothManualChooserEvents) |
824 IPC_MESSAGE_HANDLER(ShellViewMsg_LayoutDumpCompleted, OnLayoutDumpCompleted) | 824 IPC_MESSAGE_HANDLER(ShellViewMsg_LayoutDumpCompleted, OnLayoutDumpCompleted) |
| 825 IPC_MESSAGE_HANDLER(ShellViewMsg_PixelsDumpResult, OnPixelsDumpResult) |
825 IPC_MESSAGE_UNHANDLED(handled = false) | 826 IPC_MESSAGE_UNHANDLED(handled = false) |
826 IPC_END_MESSAGE_MAP() | 827 IPC_END_MESSAGE_MAP() |
827 | 828 |
828 return handled; | 829 return handled; |
829 } | 830 } |
830 | 831 |
831 void BlinkTestRunner::Navigate(const GURL& url) { | 832 void BlinkTestRunner::Navigate(const GURL& url) { |
832 focus_on_next_commit_ = true; | 833 focus_on_next_commit_ = true; |
833 } | 834 } |
834 | 835 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 for (WebView* web_view : interfaces->GetWindowList()) | 910 for (WebView* web_view : interfaces->GetWindowList()) |
910 completed_layout_dump.append(DumpHistoryForWindow(web_view)); | 911 completed_layout_dump.append(DumpHistoryForWindow(web_view)); |
911 } | 912 } |
912 | 913 |
913 Send(new ShellViewHostMsg_TextDump(routing_id(), | 914 Send(new ShellViewHostMsg_TextDump(routing_id(), |
914 std::move(completed_layout_dump))); | 915 std::move(completed_layout_dump))); |
915 | 916 |
916 CaptureDumpContinued(); | 917 CaptureDumpContinued(); |
917 } | 918 } |
918 | 919 |
| 920 void BlinkTestRunner::DumpPixelsAsync( |
| 921 base::OnceCallback<void(const SkBitmap&)> callback) { |
| 922 DCHECK(!callback.is_null()); // Caller should verify. |
| 923 CHECK(pixels_dump_callback_.is_null()) |
| 924 << "Only one pixel dump at a time is supported."; |
| 925 |
| 926 pixels_dump_callback_ = std::move(callback); |
| 927 Send(new ShellViewHostMsg_InitiatePixelsDump(routing_id())); |
| 928 } |
| 929 |
| 930 void BlinkTestRunner::OnPixelsDumpResult(const SkBitmap& result) { |
| 931 std::move(pixels_dump_callback_).Run(result); |
| 932 pixels_dump_callback_.Reset(); |
| 933 } |
| 934 |
919 void BlinkTestRunner::CaptureDumpContinued() { | 935 void BlinkTestRunner::CaptureDumpContinued() { |
920 test_runner::WebTestInterfaces* interfaces = | 936 test_runner::WebTestInterfaces* interfaces = |
921 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces(); | 937 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces(); |
922 if (test_config_->enable_pixel_dumping && | 938 if (test_config_->enable_pixel_dumping && |
923 interfaces->TestRunner()->ShouldGeneratePixelResults() && | 939 interfaces->TestRunner()->ShouldGeneratePixelResults() && |
924 !interfaces->TestRunner()->ShouldDumpAsAudio()) { | 940 !interfaces->TestRunner()->ShouldDumpAsAudio()) { |
925 CHECK(render_view()->GetWebView()->IsAcceleratedCompositingActive()); | 941 CHECK(render_view()->GetWebView()->IsAcceleratedCompositingActive()); |
926 | 942 |
927 // Test finish should only be processed in the BlinkTestRunner associated | 943 // Test finish should only be processed in the BlinkTestRunner associated |
928 // with the current, non-swapped-out RenderView. | 944 // with the current, non-swapped-out RenderView. |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 void BlinkTestRunner::ReportLeakDetectionResult( | 1094 void BlinkTestRunner::ReportLeakDetectionResult( |
1079 const LeakDetectionResult& report) { | 1095 const LeakDetectionResult& report) { |
1080 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); | 1096 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); |
1081 } | 1097 } |
1082 | 1098 |
1083 void BlinkTestRunner::OnDestruct() { | 1099 void BlinkTestRunner::OnDestruct() { |
1084 delete this; | 1100 delete this; |
1085 } | 1101 } |
1086 | 1102 |
1087 } // namespace content | 1103 } // namespace content |
OLD | NEW |