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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 .Append(FILE_PATH_LITERAL("LayoutTests/external/wpt/")) | 245 .Append(FILE_PATH_LITERAL("LayoutTests/external/wpt/")) |
246 .AppendASCII(path); | 246 .AppendASCII(path); |
247 return WebURL(net::FilePathToFileURL(new_path)); | 247 return WebURL(net::FilePathToFileURL(new_path)); |
248 } | 248 } |
249 | 249 |
250 } // namespace | 250 } // namespace |
251 | 251 |
252 BlinkTestRunner::BlinkTestRunner(RenderView* render_view) | 252 BlinkTestRunner::BlinkTestRunner(RenderView* render_view) |
253 : RenderViewObserver(render_view), | 253 : RenderViewObserver(render_view), |
254 RenderViewObserverTracker<BlinkTestRunner>(render_view), | 254 RenderViewObserverTracker<BlinkTestRunner>(render_view), |
| 255 payment_app_provider_(nullptr), |
255 is_main_window_(false), | 256 is_main_window_(false), |
256 focus_on_next_commit_(false), | 257 focus_on_next_commit_(false), |
257 leak_detector_(new LeakDetector(this)) { | 258 leak_detector_(new LeakDetector(this)) {} |
258 } | |
259 | 259 |
260 BlinkTestRunner::~BlinkTestRunner() { | 260 BlinkTestRunner::~BlinkTestRunner() { |
261 } | 261 } |
262 | 262 |
263 // WebTestDelegate ----------------------------------------------------------- | 263 // WebTestDelegate ----------------------------------------------------------- |
264 | 264 |
265 void BlinkTestRunner::ClearEditCommand() { | 265 void BlinkTestRunner::ClearEditCommand() { |
266 render_view()->ClearEditCommands(); | 266 render_view()->ClearEditCommands(); |
267 } | 267 } |
268 | 268 |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 Send(new ShellViewHostMsg_GetBluetoothManualChooserEvents(routing_id())); | 544 Send(new ShellViewHostMsg_GetBluetoothManualChooserEvents(routing_id())); |
545 } | 545 } |
546 | 546 |
547 void BlinkTestRunner::SendBluetoothManualChooserEvent( | 547 void BlinkTestRunner::SendBluetoothManualChooserEvent( |
548 const std::string& event, | 548 const std::string& event, |
549 const std::string& argument) { | 549 const std::string& argument) { |
550 Send(new ShellViewHostMsg_SendBluetoothManualChooserEvent(routing_id(), event, | 550 Send(new ShellViewHostMsg_SendBluetoothManualChooserEvent(routing_id(), event, |
551 argument)); | 551 argument)); |
552 } | 552 } |
553 | 553 |
| 554 void BlinkTestRunner::GetAllPaymentAppIDs( |
| 555 const base::Callback<void(const std::vector<int64_t>&)>& callback) { |
| 556 GetPaymentAppProvider().GetAllPaymentAppIDs(callback); |
| 557 } |
| 558 |
| 559 void BlinkTestRunner::InvokePaymentApp(int64_t registration_id) { |
| 560 GetPaymentAppProvider().InvokePaymentApp(registration_id); |
| 561 } |
| 562 |
554 void BlinkTestRunner::SetFocus(blink::WebView* web_view, bool focus) { | 563 void BlinkTestRunner::SetFocus(blink::WebView* web_view, bool focus) { |
555 RenderView* render_view = RenderView::FromWebView(web_view); | 564 RenderView* render_view = RenderView::FromWebView(web_view); |
556 if (render_view) // Check whether |web_view| has been already closed. | 565 if (render_view) // Check whether |web_view| has been already closed. |
557 SetFocusAndActivate(render_view, focus); | 566 SetFocusAndActivate(render_view, focus); |
558 } | 567 } |
559 | 568 |
560 void BlinkTestRunner::SetBlockThirdPartyCookies(bool block) { | 569 void BlinkTestRunner::SetBlockThirdPartyCookies(bool block) { |
561 Send(new LayoutTestHostMsg_BlockThirdPartyCookies(routing_id(), block)); | 570 Send(new LayoutTestHostMsg_BlockThirdPartyCookies(routing_id(), block)); |
562 } | 571 } |
563 | 572 |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 | 949 |
941 mojom::LayoutTestBluetoothFakeAdapterSetter& | 950 mojom::LayoutTestBluetoothFakeAdapterSetter& |
942 BlinkTestRunner::GetBluetoothFakeAdapterSetter() { | 951 BlinkTestRunner::GetBluetoothFakeAdapterSetter() { |
943 if (!bluetooth_fake_adapter_setter_) { | 952 if (!bluetooth_fake_adapter_setter_) { |
944 RenderThread::Get()->GetRemoteInterfaces()->GetInterface( | 953 RenderThread::Get()->GetRemoteInterfaces()->GetInterface( |
945 mojo::MakeRequest(&bluetooth_fake_adapter_setter_)); | 954 mojo::MakeRequest(&bluetooth_fake_adapter_setter_)); |
946 } | 955 } |
947 return *bluetooth_fake_adapter_setter_; | 956 return *bluetooth_fake_adapter_setter_; |
948 } | 957 } |
949 | 958 |
| 959 mojom::LayoutTestPaymentAppProvider& BlinkTestRunner::GetPaymentAppProvider() { |
| 960 if (!payment_app_provider_) { |
| 961 RenderThread::Get()->GetRemoteInterfaces()->GetInterface( |
| 962 mojo::MakeRequest(&payment_app_provider_)); |
| 963 } |
| 964 return *payment_app_provider_; |
| 965 } |
| 966 |
950 void BlinkTestRunner::OnSetupSecondaryRenderer() { | 967 void BlinkTestRunner::OnSetupSecondaryRenderer() { |
951 DCHECK(!is_main_window_); | 968 DCHECK(!is_main_window_); |
952 | 969 |
953 test_runner::WebTestInterfaces* interfaces = | 970 test_runner::WebTestInterfaces* interfaces = |
954 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces(); | 971 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces(); |
955 interfaces->SetTestIsRunning(true); | 972 interfaces->SetTestIsRunning(true); |
956 interfaces->ConfigureForTestWithURL(GURL(), false); | 973 interfaces->ConfigureForTestWithURL(GURL(), false); |
957 ForceResizeRenderView(render_view(), WebSize(800, 600)); | 974 ForceResizeRenderView(render_view(), WebSize(800, 600)); |
958 } | 975 } |
959 | 976 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 void BlinkTestRunner::ReportLeakDetectionResult( | 1048 void BlinkTestRunner::ReportLeakDetectionResult( |
1032 const LeakDetectionResult& report) { | 1049 const LeakDetectionResult& report) { |
1033 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); | 1050 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); |
1034 } | 1051 } |
1035 | 1052 |
1036 void BlinkTestRunner::OnDestruct() { | 1053 void BlinkTestRunner::OnDestruct() { |
1037 delete this; | 1054 delete this; |
1038 } | 1055 } |
1039 | 1056 |
1040 } // namespace content | 1057 } // namespace content |
OLD | NEW |