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 #include <algorithm> | 8 #include <algorithm> |
9 #include <clocale> | 9 #include <clocale> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 | 792 |
793 void BlinkTestRunner::DidClearWindowObject(WebLocalFrame* frame) { | 793 void BlinkTestRunner::DidClearWindowObject(WebLocalFrame* frame) { |
794 WebTestingSupport::injectInternalsObject(frame); | 794 WebTestingSupport::injectInternalsObject(frame); |
795 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces()->BindTo( | 795 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces()->BindTo( |
796 frame); | 796 frame); |
797 } | 797 } |
798 | 798 |
799 bool BlinkTestRunner::OnMessageReceived(const IPC::Message& message) { | 799 bool BlinkTestRunner::OnMessageReceived(const IPC::Message& message) { |
800 bool handled = true; | 800 bool handled = true; |
801 IPC_BEGIN_MESSAGE_MAP(BlinkTestRunner, message) | 801 IPC_BEGIN_MESSAGE_MAP(BlinkTestRunner, message) |
802 IPC_MESSAGE_HANDLER(ShellViewMsg_SetTestConfiguration, | |
803 OnSetTestConfiguration) | |
804 IPC_MESSAGE_HANDLER(ShellViewMsg_SessionHistory, OnSessionHistory) | 802 IPC_MESSAGE_HANDLER(ShellViewMsg_SessionHistory, OnSessionHistory) |
805 IPC_MESSAGE_HANDLER(ShellViewMsg_Reset, OnReset) | 803 IPC_MESSAGE_HANDLER(ShellViewMsg_Reset, OnReset) |
806 IPC_MESSAGE_HANDLER(ShellViewMsg_NotifyDone, OnNotifyDone) | 804 IPC_MESSAGE_HANDLER(ShellViewMsg_NotifyDone, OnNotifyDone) |
807 IPC_MESSAGE_HANDLER(ShellViewMsg_TryLeakDetection, OnTryLeakDetection) | 805 IPC_MESSAGE_HANDLER(ShellViewMsg_TryLeakDetection, OnTryLeakDetection) |
808 IPC_MESSAGE_HANDLER(ShellViewMsg_ReplyBluetoothManualChooserEvents, | 806 IPC_MESSAGE_HANDLER(ShellViewMsg_ReplyBluetoothManualChooserEvents, |
809 OnReplyBluetoothManualChooserEvents) | 807 OnReplyBluetoothManualChooserEvents) |
810 IPC_MESSAGE_HANDLER(ShellViewMsg_LayoutDumpCompleted, OnLayoutDumpCompleted) | 808 IPC_MESSAGE_HANDLER(ShellViewMsg_LayoutDumpCompleted, OnLayoutDumpCompleted) |
811 IPC_MESSAGE_UNHANDLED(handled = false) | 809 IPC_MESSAGE_UNHANDLED(handled = false) |
812 IPC_END_MESSAGE_MAP() | 810 IPC_END_MESSAGE_MAP() |
813 | 811 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 | 962 |
965 void BlinkTestRunner::CaptureDumpComplete() { | 963 void BlinkTestRunner::CaptureDumpComplete() { |
966 render_view()->GetWebView()->mainFrame()->stopLoading(); | 964 render_view()->GetWebView()->mainFrame()->stopLoading(); |
967 | 965 |
968 base::ThreadTaskRunnerHandle::Get()->PostTask( | 966 base::ThreadTaskRunnerHandle::Get()->PostTask( |
969 FROM_HERE, base::Bind(base::IgnoreResult(&BlinkTestRunner::Send), | 967 FROM_HERE, base::Bind(base::IgnoreResult(&BlinkTestRunner::Send), |
970 base::Unretained(this), | 968 base::Unretained(this), |
971 new ShellViewHostMsg_TestFinished(routing_id()))); | 969 new ShellViewHostMsg_TestFinished(routing_id()))); |
972 } | 970 } |
973 | 971 |
974 void BlinkTestRunner::OnSetTestConfiguration( | 972 void BlinkTestRunner::OnReplicateTestConfiguration( |
975 const ShellTestConfiguration& params) { | 973 const ShellTestConfiguration& params) { |
976 test_config_ = params; | 974 test_config_ = params; |
977 is_main_window_ = true; | 975 is_main_window_ = true; |
978 | 976 |
979 ForceResizeRenderView( | |
980 render_view(), | |
981 WebSize(params.initial_size.width(), params.initial_size.height())); | |
982 SetFocus(proxy_, true); | |
983 | |
984 test_runner::WebTestInterfaces* interfaces = | 977 test_runner::WebTestInterfaces* interfaces = |
985 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces(); | 978 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces(); |
986 interfaces->SetTestIsRunning(true); | 979 interfaces->SetTestIsRunning(true); |
987 interfaces->ConfigureForTestWithURL(params.test_url, | 980 interfaces->ConfigureForTestWithURL(params.test_url, |
988 params.enable_pixel_dumping); | 981 params.enable_pixel_dumping); |
989 } | 982 } |
990 | 983 |
| 984 void BlinkTestRunner::OnSetTestConfiguration( |
| 985 const ShellTestConfiguration& params) { |
| 986 OnReplicateTestConfiguration(params); |
| 987 |
| 988 ForceResizeRenderView( |
| 989 render_view(), |
| 990 WebSize(params.initial_size.width(), params.initial_size.height())); |
| 991 SetFocus(proxy_, true); |
| 992 } |
| 993 |
991 void BlinkTestRunner::OnSessionHistory( | 994 void BlinkTestRunner::OnSessionHistory( |
992 const std::vector<int>& routing_ids, | 995 const std::vector<int>& routing_ids, |
993 const std::vector<std::vector<PageState>>& session_histories, | 996 const std::vector<std::vector<PageState>>& session_histories, |
994 const std::vector<unsigned>& current_entry_indexes) { | 997 const std::vector<unsigned>& current_entry_indexes) { |
995 routing_ids_ = routing_ids; | 998 routing_ids_ = routing_ids; |
996 session_histories_ = session_histories; | 999 session_histories_ = session_histories; |
997 current_entry_indexes_ = current_entry_indexes; | 1000 current_entry_indexes_ = current_entry_indexes; |
998 CaptureDump(); | 1001 CaptureDump(); |
999 } | 1002 } |
1000 | 1003 |
(...skipping 29 matching lines...) Expand all Loading... |
1030 get_bluetooth_events_callbacks_.pop_front(); | 1033 get_bluetooth_events_callbacks_.pop_front(); |
1031 callback.Run(events); | 1034 callback.Run(events); |
1032 } | 1035 } |
1033 | 1036 |
1034 void BlinkTestRunner::ReportLeakDetectionResult( | 1037 void BlinkTestRunner::ReportLeakDetectionResult( |
1035 const LeakDetectionResult& report) { | 1038 const LeakDetectionResult& report) { |
1036 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); | 1039 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); |
1037 } | 1040 } |
1038 | 1041 |
1039 } // namespace content | 1042 } // namespace content |
OLD | NEW |