| 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 23 matching lines...) Expand all Loading... |
| 34 #include "components/test_runner/layout_dump.h" | 34 #include "components/test_runner/layout_dump.h" |
| 35 #include "components/test_runner/layout_dump_flags.h" | 35 #include "components/test_runner/layout_dump_flags.h" |
| 36 #include "components/test_runner/mock_screen_orientation_client.h" | 36 #include "components/test_runner/mock_screen_orientation_client.h" |
| 37 #include "components/test_runner/test_interfaces.h" | 37 #include "components/test_runner/test_interfaces.h" |
| 38 #include "components/test_runner/tracked_dictionary.h" | 38 #include "components/test_runner/tracked_dictionary.h" |
| 39 #include "components/test_runner/web_task.h" | 39 #include "components/test_runner/web_task.h" |
| 40 #include "components/test_runner/web_test_interfaces.h" | 40 #include "components/test_runner/web_test_interfaces.h" |
| 41 #include "components/test_runner/web_test_proxy.h" | 41 #include "components/test_runner/web_test_proxy.h" |
| 42 #include "components/test_runner/web_test_runner.h" | 42 #include "components/test_runner/web_test_runner.h" |
| 43 #include "content/public/common/content_switches.h" | 43 #include "content/public/common/content_switches.h" |
| 44 #include "content/public/common/service_registry.h" |
| 44 #include "content/public/common/url_constants.h" | 45 #include "content/public/common/url_constants.h" |
| 45 #include "content/public/common/web_preferences.h" | 46 #include "content/public/common/web_preferences.h" |
| 46 #include "content/public/renderer/media_stream_api.h" | 47 #include "content/public/renderer/media_stream_api.h" |
| 47 #include "content/public/renderer/render_frame.h" | 48 #include "content/public/renderer/render_frame.h" |
| 48 #include "content/public/renderer/render_view.h" | 49 #include "content/public/renderer/render_view.h" |
| 49 #include "content/public/renderer/render_view_visitor.h" | 50 #include "content/public/renderer/render_view_visitor.h" |
| 50 #include "content/public/renderer/renderer_gamepad_provider.h" | 51 #include "content/public/renderer/renderer_gamepad_provider.h" |
| 51 #include "content/public/test/layouttest_support.h" | 52 #include "content/public/test/layouttest_support.h" |
| 52 #include "content/shell/common/layout_test/layout_test_messages.h" | 53 #include "content/shell/common/layout_test/layout_test_messages.h" |
| 53 #include "content/shell/common/shell_messages.h" | 54 #include "content/shell/common/shell_messages.h" |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 content::SetDeviceColorProfile(render_view(), name); | 523 content::SetDeviceColorProfile(render_view(), name); |
| 523 } | 524 } |
| 524 | 525 |
| 525 void BlinkTestRunner::SetBluetoothMockDataSet(const std::string& name) { | 526 void BlinkTestRunner::SetBluetoothMockDataSet(const std::string& name) { |
| 526 Send(new LayoutTestHostMsg_SetBluetoothAdapter(name)); | 527 Send(new LayoutTestHostMsg_SetBluetoothAdapter(name)); |
| 527 // Auto-reset the chooser type so we don't get order dependence when some | 528 // Auto-reset the chooser type so we don't get order dependence when some |
| 528 // tests forget to do it explicitly. | 529 // tests forget to do it explicitly. |
| 529 Send(new ShellViewHostMsg_SetBluetoothManualChooser(routing_id(), false)); | 530 Send(new ShellViewHostMsg_SetBluetoothManualChooser(routing_id(), false)); |
| 530 } | 531 } |
| 531 | 532 |
| 533 void BlinkTestRunner::SetBluetoothFakeAdapter(const std::string& adapter_name, |
| 534 const base::Closure& callback) { |
| 535 GetBluetoothFakeAdapterSetter()->Set(adapter_name, callback); |
| 536 } |
| 537 |
| 532 void BlinkTestRunner::SetBluetoothManualChooser() { | 538 void BlinkTestRunner::SetBluetoothManualChooser() { |
| 533 Send(new ShellViewHostMsg_SetBluetoothManualChooser(routing_id(), true)); | 539 Send(new ShellViewHostMsg_SetBluetoothManualChooser(routing_id(), true)); |
| 534 } | 540 } |
| 535 | 541 |
| 536 void BlinkTestRunner::GetBluetoothManualChooserEvents( | 542 void BlinkTestRunner::GetBluetoothManualChooserEvents( |
| 537 const base::Callback<void(const std::vector<std::string>&)>& callback) { | 543 const base::Callback<void(const std::vector<std::string>&)>& callback) { |
| 538 get_bluetooth_events_callbacks_.push_back(callback); | 544 get_bluetooth_events_callbacks_.push_back(callback); |
| 539 Send(new ShellViewHostMsg_GetBluetoothManualChooserEvents(routing_id())); | 545 Send(new ShellViewHostMsg_GetBluetoothManualChooserEvents(routing_id())); |
| 540 } | 546 } |
| 541 | 547 |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 | 997 |
| 992 void BlinkTestRunner::CaptureDumpComplete() { | 998 void BlinkTestRunner::CaptureDumpComplete() { |
| 993 render_view()->GetWebView()->mainFrame()->stopLoading(); | 999 render_view()->GetWebView()->mainFrame()->stopLoading(); |
| 994 | 1000 |
| 995 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1001 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 996 FROM_HERE, base::Bind(base::IgnoreResult(&BlinkTestRunner::Send), | 1002 FROM_HERE, base::Bind(base::IgnoreResult(&BlinkTestRunner::Send), |
| 997 base::Unretained(this), | 1003 base::Unretained(this), |
| 998 new ShellViewHostMsg_TestFinished(routing_id()))); | 1004 new ShellViewHostMsg_TestFinished(routing_id()))); |
| 999 } | 1005 } |
| 1000 | 1006 |
| 1007 mojom::LayoutTestBluetoothFakeAdapterSetterPtr& |
| 1008 BlinkTestRunner::GetBluetoothFakeAdapterSetter() { |
| 1009 if (!bluetooth_fake_adapter_setter_) { |
| 1010 RenderThread::Get()->GetServiceRegistry()->ConnectToRemoteService( |
| 1011 mojo::GetProxy(&bluetooth_fake_adapter_setter_)); |
| 1012 } |
| 1013 return bluetooth_fake_adapter_setter_; |
| 1014 } |
| 1015 |
| 1001 void BlinkTestRunner::OnReplicateTestConfiguration( | 1016 void BlinkTestRunner::OnReplicateTestConfiguration( |
| 1002 const ShellTestConfiguration& params) { | 1017 const ShellTestConfiguration& params) { |
| 1003 test_config_ = params; | 1018 test_config_ = params; |
| 1004 is_main_window_ = true; | 1019 is_main_window_ = true; |
| 1005 | 1020 |
| 1006 test_runner::WebTestInterfaces* interfaces = | 1021 test_runner::WebTestInterfaces* interfaces = |
| 1007 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces(); | 1022 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces(); |
| 1008 interfaces->SetTestIsRunning(true); | 1023 interfaces->SetTestIsRunning(true); |
| 1009 interfaces->ConfigureForTestWithURL(params.test_url, | 1024 interfaces->ConfigureForTestWithURL(params.test_url, |
| 1010 params.enable_pixel_dumping); | 1025 params.enable_pixel_dumping); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1062 get_bluetooth_events_callbacks_.pop_front(); | 1077 get_bluetooth_events_callbacks_.pop_front(); |
| 1063 callback.Run(events); | 1078 callback.Run(events); |
| 1064 } | 1079 } |
| 1065 | 1080 |
| 1066 void BlinkTestRunner::ReportLeakDetectionResult( | 1081 void BlinkTestRunner::ReportLeakDetectionResult( |
| 1067 const LeakDetectionResult& report) { | 1082 const LeakDetectionResult& report) { |
| 1068 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); | 1083 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); |
| 1069 } | 1084 } |
| 1070 | 1085 |
| 1071 } // namespace content | 1086 } // namespace content |
| OLD | NEW |