| 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 16 matching lines...) Expand all Loading... |
| 27 #include "base/thread_task_runner_handle.h" | 27 #include "base/thread_task_runner_handle.h" |
| 28 #include "base/time/time.h" | 28 #include "base/time/time.h" |
| 29 #include "base/values.h" | 29 #include "base/values.h" |
| 30 #include "build/build_config.h" | 30 #include "build/build_config.h" |
| 31 #include "components/plugins/renderer/plugin_placeholder.h" | 31 #include "components/plugins/renderer/plugin_placeholder.h" |
| 32 #include "components/test_runner/gamepad_controller.h" | 32 #include "components/test_runner/gamepad_controller.h" |
| 33 #include "components/test_runner/web_test_interfaces.h" | 33 #include "components/test_runner/web_test_interfaces.h" |
| 34 #include "components/test_runner/web_test_proxy.h" | 34 #include "components/test_runner/web_test_proxy.h" |
| 35 #include "components/test_runner/web_test_runner.h" | 35 #include "components/test_runner/web_test_runner.h" |
| 36 #include "content/public/common/content_switches.h" | 36 #include "content/public/common/content_switches.h" |
| 37 #include "content/public/common/service_registry.h" |
| 37 #include "content/public/common/url_constants.h" | 38 #include "content/public/common/url_constants.h" |
| 38 #include "content/public/common/web_preferences.h" | 39 #include "content/public/common/web_preferences.h" |
| 39 #include "content/public/renderer/media_stream_utils.h" | 40 #include "content/public/renderer/media_stream_utils.h" |
| 40 #include "content/public/renderer/render_frame.h" | 41 #include "content/public/renderer/render_frame.h" |
| 41 #include "content/public/renderer/render_view.h" | 42 #include "content/public/renderer/render_view.h" |
| 42 #include "content/public/renderer/render_view_visitor.h" | 43 #include "content/public/renderer/render_view_visitor.h" |
| 43 #include "content/public/renderer/renderer_gamepad_provider.h" | 44 #include "content/public/renderer/renderer_gamepad_provider.h" |
| 44 #include "content/public/test/layouttest_support.h" | 45 #include "content/public/test/layouttest_support.h" |
| 45 #include "content/shell/common/layout_test/layout_test_messages.h" | 46 #include "content/shell/common/layout_test/layout_test_messages.h" |
| 46 #include "content/shell/common/shell_messages.h" | 47 #include "content/shell/common/shell_messages.h" |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 | 473 |
| 473 void BlinkTestRunner::EnableUseZoomForDSF() { | 474 void BlinkTestRunner::EnableUseZoomForDSF() { |
| 474 base::CommandLine::ForCurrentProcess()-> | 475 base::CommandLine::ForCurrentProcess()-> |
| 475 AppendSwitch(switches::kEnableUseZoomForDSF); | 476 AppendSwitch(switches::kEnableUseZoomForDSF); |
| 476 } | 477 } |
| 477 | 478 |
| 478 void BlinkTestRunner::SetDeviceColorProfile(const std::string& name) { | 479 void BlinkTestRunner::SetDeviceColorProfile(const std::string& name) { |
| 479 content::SetDeviceColorProfile(render_view(), name); | 480 content::SetDeviceColorProfile(render_view(), name); |
| 480 } | 481 } |
| 481 | 482 |
| 482 void BlinkTestRunner::SetBluetoothMockDataSet(const std::string& name) { | 483 void BlinkTestRunner::SetBluetoothFakeAdapter(const std::string& adapter_name, |
| 483 Send(new LayoutTestHostMsg_SetBluetoothAdapter(name)); | 484 const base::Closure& callback) { |
| 484 // Auto-reset the chooser type so we don't get order dependence when some | 485 GetBluetoothFakeAdapterSetter()->Set(adapter_name, callback); |
| 485 // tests forget to do it explicitly. | |
| 486 Send(new ShellViewHostMsg_SetBluetoothManualChooser(routing_id(), false)); | |
| 487 } | 486 } |
| 488 | 487 |
| 489 void BlinkTestRunner::SetBluetoothManualChooser() { | 488 void BlinkTestRunner::SetBluetoothManualChooser(bool enable) { |
| 490 Send(new ShellViewHostMsg_SetBluetoothManualChooser(routing_id(), true)); | 489 Send(new ShellViewHostMsg_SetBluetoothManualChooser(routing_id(), enable)); |
| 491 } | 490 } |
| 492 | 491 |
| 493 void BlinkTestRunner::GetBluetoothManualChooserEvents( | 492 void BlinkTestRunner::GetBluetoothManualChooserEvents( |
| 494 const base::Callback<void(const std::vector<std::string>&)>& callback) { | 493 const base::Callback<void(const std::vector<std::string>&)>& callback) { |
| 495 get_bluetooth_events_callbacks_.push_back(callback); | 494 get_bluetooth_events_callbacks_.push_back(callback); |
| 496 Send(new ShellViewHostMsg_GetBluetoothManualChooserEvents(routing_id())); | 495 Send(new ShellViewHostMsg_GetBluetoothManualChooserEvents(routing_id())); |
| 497 } | 496 } |
| 498 | 497 |
| 499 void BlinkTestRunner::SendBluetoothManualChooserEvent( | 498 void BlinkTestRunner::SendBluetoothManualChooserEvent( |
| 500 const std::string& event, | 499 const std::string& event, |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 | 937 |
| 939 void BlinkTestRunner::CaptureDumpComplete() { | 938 void BlinkTestRunner::CaptureDumpComplete() { |
| 940 render_view()->GetWebView()->mainFrame()->stopLoading(); | 939 render_view()->GetWebView()->mainFrame()->stopLoading(); |
| 941 | 940 |
| 942 base::ThreadTaskRunnerHandle::Get()->PostTask( | 941 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 943 FROM_HERE, base::Bind(base::IgnoreResult(&BlinkTestRunner::Send), | 942 FROM_HERE, base::Bind(base::IgnoreResult(&BlinkTestRunner::Send), |
| 944 base::Unretained(this), | 943 base::Unretained(this), |
| 945 new ShellViewHostMsg_TestFinished(routing_id()))); | 944 new ShellViewHostMsg_TestFinished(routing_id()))); |
| 946 } | 945 } |
| 947 | 946 |
| 947 mojom::LayoutTestBluetoothFakeAdapterSetterPtr& |
| 948 BlinkTestRunner::GetBluetoothFakeAdapterSetter() { |
| 949 if (!bluetooth_fake_adapter_setter_) { |
| 950 RenderThread::Get()->GetServiceRegistry()->ConnectToRemoteService( |
| 951 mojo::GetProxy(&bluetooth_fake_adapter_setter_)); |
| 952 } |
| 953 return bluetooth_fake_adapter_setter_; |
| 954 } |
| 955 |
| 948 void BlinkTestRunner::OnReplicateTestConfiguration( | 956 void BlinkTestRunner::OnReplicateTestConfiguration( |
| 949 const ShellTestConfiguration& params) { | 957 const ShellTestConfiguration& params) { |
| 950 test_config_ = params; | 958 test_config_ = params; |
| 951 is_main_window_ = true; | 959 is_main_window_ = true; |
| 952 | 960 |
| 953 test_runner::WebTestInterfaces* interfaces = | 961 test_runner::WebTestInterfaces* interfaces = |
| 954 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces(); | 962 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces(); |
| 955 interfaces->SetTestIsRunning(true); | 963 interfaces->SetTestIsRunning(true); |
| 956 interfaces->ConfigureForTestWithURL(params.test_url, | 964 interfaces->ConfigureForTestWithURL(params.test_url, |
| 957 params.enable_pixel_dumping); | 965 params.enable_pixel_dumping); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 get_bluetooth_events_callbacks_.pop_front(); | 1017 get_bluetooth_events_callbacks_.pop_front(); |
| 1010 callback.Run(events); | 1018 callback.Run(events); |
| 1011 } | 1019 } |
| 1012 | 1020 |
| 1013 void BlinkTestRunner::ReportLeakDetectionResult( | 1021 void BlinkTestRunner::ReportLeakDetectionResult( |
| 1014 const LeakDetectionResult& report) { | 1022 const LeakDetectionResult& report) { |
| 1015 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); | 1023 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); |
| 1016 } | 1024 } |
| 1017 | 1025 |
| 1018 } // namespace content | 1026 } // namespace content |
| OLD | NEW |