OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/test_runner/web_test_proxy.h" | 5 #include "content/shell/renderer/test_runner/web_test_proxy.h" |
6 | 6 |
7 #include <cctype> | 7 #include <cctype> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "content/shell/renderer/test_runner/MockWebSpeechRecognizer.h" | |
14 #include "content/shell/renderer/test_runner/SpellCheckClient.h" | 13 #include "content/shell/renderer/test_runner/SpellCheckClient.h" |
15 #include "content/shell/renderer/test_runner/TestCommon.h" | 14 #include "content/shell/renderer/test_runner/TestCommon.h" |
16 #include "content/shell/renderer/test_runner/TestInterfaces.h" | 15 #include "content/shell/renderer/test_runner/TestInterfaces.h" |
17 #include "content/shell/renderer/test_runner/TestPlugin.h" | 16 #include "content/shell/renderer/test_runner/TestPlugin.h" |
18 #include "content/shell/renderer/test_runner/WebTestDelegate.h" | 17 #include "content/shell/renderer/test_runner/WebTestDelegate.h" |
19 #include "content/shell/renderer/test_runner/WebTestInterfaces.h" | 18 #include "content/shell/renderer/test_runner/WebTestInterfaces.h" |
20 #include "content/shell/renderer/test_runner/accessibility_controller.h" | 19 #include "content/shell/renderer/test_runner/accessibility_controller.h" |
21 #include "content/shell/renderer/test_runner/event_sender.h" | 20 #include "content/shell/renderer/test_runner/event_sender.h" |
22 #include "content/shell/renderer/test_runner/mock_color_chooser.h" | 21 #include "content/shell/renderer/test_runner/mock_color_chooser.h" |
23 #include "content/shell/renderer/test_runner/mock_screen_orientation_client.h" | 22 #include "content/shell/renderer/test_runner/mock_screen_orientation_client.h" |
24 #include "content/shell/renderer/test_runner/mock_web_push_client.h" | 23 #include "content/shell/renderer/test_runner/mock_web_push_client.h" |
| 24 #include "content/shell/renderer/test_runner/mock_web_speech_recognizer.h" |
25 #include "content/shell/renderer/test_runner/mock_web_user_media_client.h" | 25 #include "content/shell/renderer/test_runner/mock_web_user_media_client.h" |
26 #include "content/shell/renderer/test_runner/test_runner.h" | 26 #include "content/shell/renderer/test_runner/test_runner.h" |
27 #include "content/shell/renderer/test_runner/web_test_runner.h" | 27 #include "content/shell/renderer/test_runner/web_test_runner.h" |
28 // FIXME: Including platform_canvas.h here is a layering violation. | 28 // FIXME: Including platform_canvas.h here is a layering violation. |
29 #include "skia/ext/platform_canvas.h" | 29 #include "skia/ext/platform_canvas.h" |
30 #include "third_party/WebKit/public/platform/Platform.h" | 30 #include "third_party/WebKit/public/platform/Platform.h" |
31 #include "third_party/WebKit/public/platform/WebCString.h" | 31 #include "third_party/WebKit/public/platform/WebCString.h" |
32 #include "third_party/WebKit/public/platform/WebClipboard.h" | 32 #include "third_party/WebKit/public/platform/WebClipboard.h" |
33 #include "third_party/WebKit/public/platform/WebURLError.h" | 33 #include "third_party/WebKit/public/platform/WebURLError.h" |
34 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 34 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 | 325 |
326 void WebTestProxyBase::SetInterfaces(WebTestInterfaces* interfaces) { | 326 void WebTestProxyBase::SetInterfaces(WebTestInterfaces* interfaces) { |
327 test_interfaces_ = interfaces->testInterfaces(); | 327 test_interfaces_ = interfaces->testInterfaces(); |
328 test_interfaces_->windowOpened(this); | 328 test_interfaces_->windowOpened(this); |
329 } | 329 } |
330 | 330 |
331 void WebTestProxyBase::SetDelegate(WebTestDelegate* delegate) { | 331 void WebTestProxyBase::SetDelegate(WebTestDelegate* delegate) { |
332 delegate_ = delegate; | 332 delegate_ = delegate; |
333 spellcheck_->setDelegate(delegate); | 333 spellcheck_->setDelegate(delegate); |
334 if (speech_recognizer_.get()) | 334 if (speech_recognizer_.get()) |
335 speech_recognizer_->setDelegate(delegate); | 335 speech_recognizer_->SetDelegate(delegate); |
336 } | 336 } |
337 | 337 |
338 blink::WebView* WebTestProxyBase::GetWebView() const { | 338 blink::WebView* WebTestProxyBase::GetWebView() const { |
339 DCHECK(web_widget_); | 339 DCHECK(web_widget_); |
340 // TestRunner does not support popup widgets. So |web_widget|_ is always a | 340 // TestRunner does not support popup widgets. So |web_widget|_ is always a |
341 // WebView. | 341 // WebView. |
342 return static_cast<blink::WebView*>(web_widget_); | 342 return static_cast<blink::WebView*>(web_widget_); |
343 } | 343 } |
344 | 344 |
345 void WebTestProxyBase::Reset() { | 345 void WebTestProxyBase::Reset() { |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 | 577 |
578 blink::WebMIDIClientMock* WebTestProxyBase::GetMIDIClientMock() { | 578 blink::WebMIDIClientMock* WebTestProxyBase::GetMIDIClientMock() { |
579 if (!midi_client_.get()) | 579 if (!midi_client_.get()) |
580 midi_client_.reset(new blink::WebMIDIClientMock); | 580 midi_client_.reset(new blink::WebMIDIClientMock); |
581 return midi_client_.get(); | 581 return midi_client_.get(); |
582 } | 582 } |
583 | 583 |
584 MockWebSpeechRecognizer* WebTestProxyBase::GetSpeechRecognizerMock() { | 584 MockWebSpeechRecognizer* WebTestProxyBase::GetSpeechRecognizerMock() { |
585 if (!speech_recognizer_.get()) { | 585 if (!speech_recognizer_.get()) { |
586 speech_recognizer_.reset(new MockWebSpeechRecognizer()); | 586 speech_recognizer_.reset(new MockWebSpeechRecognizer()); |
587 speech_recognizer_->setDelegate(delegate_); | 587 speech_recognizer_->SetDelegate(delegate_); |
588 } | 588 } |
589 return speech_recognizer_.get(); | 589 return speech_recognizer_.get(); |
590 } | 590 } |
591 | 591 |
592 void WebTestProxyBase::ScheduleAnimation() { | 592 void WebTestProxyBase::ScheduleAnimation() { |
593 if (!test_interfaces_->testRunner()->TestIsRunning()) | 593 if (!test_interfaces_->testRunner()->TestIsRunning()) |
594 return; | 594 return; |
595 | 595 |
596 if (!animate_scheduled_) { | 596 if (!animate_scheduled_) { |
597 animate_scheduled_ = true; | 597 animate_scheduled_ = true; |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 if (!push_client_.get()) | 1257 if (!push_client_.get()) |
1258 push_client_.reset(new MockWebPushClient); | 1258 push_client_.reset(new MockWebPushClient); |
1259 return push_client_.get(); | 1259 return push_client_.get(); |
1260 } | 1260 } |
1261 | 1261 |
1262 blink::WebPushClient* WebTestProxyBase::GetWebPushClient() { | 1262 blink::WebPushClient* WebTestProxyBase::GetWebPushClient() { |
1263 return GetPushClientMock(); | 1263 return GetPushClientMock(); |
1264 } | 1264 } |
1265 | 1265 |
1266 } // namespace content | 1266 } // namespace content |
OLD | NEW |