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