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 "content/shell/renderer/test_runner/MockColorChooser.h" | 12 #include "content/shell/renderer/test_runner/MockColorChooser.h" |
13 #include "content/shell/renderer/test_runner/MockWebSpeechRecognizer.h" | 13 #include "content/shell/renderer/test_runner/MockWebSpeechRecognizer.h" |
14 #include "content/shell/renderer/test_runner/SpellCheckClient.h" | 14 #include "content/shell/renderer/test_runner/SpellCheckClient.h" |
15 #include "content/shell/renderer/test_runner/TestCommon.h" | 15 #include "content/shell/renderer/test_runner/TestCommon.h" |
16 #include "content/shell/renderer/test_runner/TestInterfaces.h" | 16 #include "content/shell/renderer/test_runner/TestInterfaces.h" |
17 #include "content/shell/renderer/test_runner/TestPlugin.h" | 17 #include "content/shell/renderer/test_runner/TestPlugin.h" |
18 #include "content/shell/renderer/test_runner/WebTestDelegate.h" | 18 #include "content/shell/renderer/test_runner/WebTestDelegate.h" |
19 #include "content/shell/renderer/test_runner/WebTestInterfaces.h" | 19 #include "content/shell/renderer/test_runner/WebTestInterfaces.h" |
20 #include "content/shell/renderer/test_runner/accessibility_controller.h" | 20 #include "content/shell/renderer/test_runner/accessibility_controller.h" |
21 #include "content/shell/renderer/test_runner/event_sender.h" | 21 #include "content/shell/renderer/test_runner/event_sender.h" |
| 22 #include "content/shell/renderer/test_runner/mock_screen_orientation_client.h" |
22 #include "content/shell/renderer/test_runner/mock_web_push_client.h" | 23 #include "content/shell/renderer/test_runner/mock_web_push_client.h" |
23 #include "content/shell/renderer/test_runner/mock_web_user_media_client.h" | 24 #include "content/shell/renderer/test_runner/mock_web_user_media_client.h" |
24 #include "content/shell/renderer/test_runner/test_runner.h" | 25 #include "content/shell/renderer/test_runner/test_runner.h" |
25 #include "content/shell/renderer/test_runner/web_test_runner.h" | 26 #include "content/shell/renderer/test_runner/web_test_runner.h" |
26 // FIXME: Including platform_canvas.h here is a layering violation. | 27 // FIXME: Including platform_canvas.h here is a layering violation. |
27 #include "skia/ext/platform_canvas.h" | 28 #include "skia/ext/platform_canvas.h" |
28 #include "third_party/WebKit/public/platform/WebCString.h" | 29 #include "third_party/WebKit/public/platform/WebCString.h" |
29 #include "third_party/WebKit/public/platform/WebURLError.h" | 30 #include "third_party/WebKit/public/platform/WebURLError.h" |
30 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 31 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
31 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 32 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 } | 522 } |
522 | 523 |
523 void WebTestProxyBase::DisplayAsyncThen(const base::Closure& callback) { | 524 void WebTestProxyBase::DisplayAsyncThen(const base::Closure& callback) { |
524 TRACE_EVENT0("shell", "WebTestProxyBase::DisplayAsyncThen"); | 525 TRACE_EVENT0("shell", "WebTestProxyBase::DisplayAsyncThen"); |
525 | 526 |
526 CHECK(web_widget_->isAcceleratedCompositingActive()); | 527 CHECK(web_widget_->isAcceleratedCompositingActive()); |
527 CapturePixelsAsync(base::Bind( | 528 CapturePixelsAsync(base::Bind( |
528 &WebTestProxyBase::DidDisplayAsync, base::Unretained(this), callback)); | 529 &WebTestProxyBase::DidDisplayAsync, base::Unretained(this), callback)); |
529 } | 530 } |
530 | 531 |
| 532 void WebTestProxyBase::GetScreenOrientationForTesting( |
| 533 blink::WebScreenInfo& screen_info) { |
| 534 if (!screen_orientation_client_) |
| 535 return; |
| 536 // Override screen orientation information with mock data. |
| 537 screen_info.orientationType = |
| 538 screen_orientation_client_->CurrentOrientationType(); |
| 539 screen_info.orientationAngle = |
| 540 screen_orientation_client_->CurrentOrientationAngle(); |
| 541 } |
| 542 |
| 543 MockScreenOrientationClient* |
| 544 WebTestProxyBase::GetScreenOrientationClientMock() { |
| 545 if (!screen_orientation_client_.get()) { |
| 546 screen_orientation_client_.reset(new MockScreenOrientationClient); |
| 547 } |
| 548 return screen_orientation_client_.get(); |
| 549 } |
| 550 |
531 blink::WebMIDIClientMock* WebTestProxyBase::GetMIDIClientMock() { | 551 blink::WebMIDIClientMock* WebTestProxyBase::GetMIDIClientMock() { |
532 if (!midi_client_.get()) | 552 if (!midi_client_.get()) |
533 midi_client_.reset(new blink::WebMIDIClientMock); | 553 midi_client_.reset(new blink::WebMIDIClientMock); |
534 return midi_client_.get(); | 554 return midi_client_.get(); |
535 } | 555 } |
536 | 556 |
537 MockWebSpeechRecognizer* WebTestProxyBase::GetSpeechRecognizerMock() { | 557 MockWebSpeechRecognizer* WebTestProxyBase::GetSpeechRecognizerMock() { |
538 if (!speech_recognizer_.get()) { | 558 if (!speech_recognizer_.get()) { |
539 speech_recognizer_.reset(new MockWebSpeechRecognizer()); | 559 speech_recognizer_.reset(new MockWebSpeechRecognizer()); |
540 speech_recognizer_->setDelegate(delegate_); | 560 speech_recognizer_->setDelegate(delegate_); |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 if (!push_client_.get()) | 1239 if (!push_client_.get()) |
1220 push_client_.reset(new MockWebPushClient); | 1240 push_client_.reset(new MockWebPushClient); |
1221 return push_client_.get(); | 1241 return push_client_.get(); |
1222 } | 1242 } |
1223 | 1243 |
1224 blink::WebPushClient* WebTestProxyBase::GetWebPushClient() { | 1244 blink::WebPushClient* WebTestProxyBase::GetWebPushClient() { |
1225 return GetPushClientMock(); | 1245 return GetPushClientMock(); |
1226 } | 1246 } |
1227 | 1247 |
1228 } // namespace content | 1248 } // namespace content |
OLD | NEW |