| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/WebTestProxy.h" | 5 #include "content/shell/renderer/test_runner/WebTestProxy.h" |
| 6 | 6 |
| 7 #include <cctype> | 7 #include <cctype> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "content/shell/renderer/test_runner/event_sender.h" | 10 #include "content/shell/renderer/test_runner/event_sender.h" |
| 11 #include "content/shell/renderer/test_runner/MockColorChooser.h" | 11 #include "content/shell/renderer/test_runner/MockColorChooser.h" |
| 12 #include "content/shell/renderer/test_runner/MockWebSpeechInputController.h" | |
| 13 #include "content/shell/renderer/test_runner/MockWebSpeechRecognizer.h" | 12 #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/WebTestRunner.h" | 19 #include "content/shell/renderer/test_runner/WebTestRunner.h" |
| 21 #include "content/shell/renderer/test_runner/WebUserMediaClientMock.h" | 20 #include "content/shell/renderer/test_runner/WebUserMediaClientMock.h" |
| 22 #include "content/shell/renderer/test_runner/accessibility_controller.h" | 21 #include "content/shell/renderer/test_runner/accessibility_controller.h" |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 void WebTestProxyBase::setInterfaces(WebTestInterfaces* interfaces) | 332 void WebTestProxyBase::setInterfaces(WebTestInterfaces* interfaces) |
| 334 { | 333 { |
| 335 m_testInterfaces = interfaces->testInterfaces(); | 334 m_testInterfaces = interfaces->testInterfaces(); |
| 336 m_testInterfaces->windowOpened(this); | 335 m_testInterfaces->windowOpened(this); |
| 337 } | 336 } |
| 338 | 337 |
| 339 void WebTestProxyBase::setDelegate(WebTestDelegate* delegate) | 338 void WebTestProxyBase::setDelegate(WebTestDelegate* delegate) |
| 340 { | 339 { |
| 341 m_delegate = delegate; | 340 m_delegate = delegate; |
| 342 m_spellcheck->setDelegate(delegate); | 341 m_spellcheck->setDelegate(delegate); |
| 343 #if ENABLE_INPUT_SPEECH | |
| 344 if (m_speechInputController.get()) | |
| 345 m_speechInputController->setDelegate(delegate); | |
| 346 #endif | |
| 347 if (m_speechRecognizer.get()) | 342 if (m_speechRecognizer.get()) |
| 348 m_speechRecognizer->setDelegate(delegate); | 343 m_speechRecognizer->setDelegate(delegate); |
| 349 } | 344 } |
| 350 | 345 |
| 351 void WebTestProxyBase::setWidget(WebWidget* widget) | 346 void WebTestProxyBase::setWidget(WebWidget* widget) |
| 352 { | 347 { |
| 353 m_webWidget = widget; | 348 m_webWidget = widget; |
| 354 } | 349 } |
| 355 | 350 |
| 356 WebWidget* WebTestProxyBase::webWidget() | 351 WebWidget* WebTestProxyBase::webWidget() |
| (...skipping 17 matching lines...) Expand all Loading... |
| 374 void WebTestProxyBase::reset() | 369 void WebTestProxyBase::reset() |
| 375 { | 370 { |
| 376 m_paintRect = WebRect(); | 371 m_paintRect = WebRect(); |
| 377 m_canvas.reset(); | 372 m_canvas.reset(); |
| 378 m_isPainting = false; | 373 m_isPainting = false; |
| 379 m_animateScheduled = false; | 374 m_animateScheduled = false; |
| 380 m_resourceIdentifierMap.clear(); | 375 m_resourceIdentifierMap.clear(); |
| 381 m_logConsoleOutput = true; | 376 m_logConsoleOutput = true; |
| 382 if (m_midiClient.get()) | 377 if (m_midiClient.get()) |
| 383 m_midiClient->resetMock(); | 378 m_midiClient->resetMock(); |
| 384 #if ENABLE_INPUT_SPEECH | |
| 385 if (m_speechInputController.get()) | |
| 386 m_speechInputController->clearResults(); | |
| 387 #endif | |
| 388 } | 379 } |
| 389 | 380 |
| 390 WebSpellCheckClient* WebTestProxyBase::spellCheckClient() const | 381 WebSpellCheckClient* WebTestProxyBase::spellCheckClient() const |
| 391 { | 382 { |
| 392 return m_spellcheck.get(); | 383 return m_spellcheck.get(); |
| 393 } | 384 } |
| 394 | 385 |
| 395 WebColorChooser* WebTestProxyBase::createColorChooser(WebColorChooserClient* cli
ent, const blink::WebColor& color, const blink::WebVector<blink::WebColorSuggest
ion>& suggestions) | 386 WebColorChooser* WebTestProxyBase::createColorChooser(WebColorChooserClient* cli
ent, const blink::WebColor& color, const blink::WebVector<blink::WebColorSuggest
ion>& suggestions) |
| 396 { | 387 { |
| 397 // This instance is deleted by WebCore::ColorInputType | 388 // This instance is deleted by WebCore::ColorInputType |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 m_canvas.reset(); | 589 m_canvas.reset(); |
| 599 } | 590 } |
| 600 | 591 |
| 601 WebMIDIClientMock* WebTestProxyBase::midiClientMock() | 592 WebMIDIClientMock* WebTestProxyBase::midiClientMock() |
| 602 { | 593 { |
| 603 if (!m_midiClient.get()) | 594 if (!m_midiClient.get()) |
| 604 m_midiClient.reset(new WebMIDIClientMock); | 595 m_midiClient.reset(new WebMIDIClientMock); |
| 605 return m_midiClient.get(); | 596 return m_midiClient.get(); |
| 606 } | 597 } |
| 607 | 598 |
| 608 #if ENABLE_INPUT_SPEECH | |
| 609 MockWebSpeechInputController* WebTestProxyBase::speechInputControllerMock() | |
| 610 { | |
| 611 DCHECK(m_speechInputController.get()); | |
| 612 return m_speechInputController.get(); | |
| 613 } | |
| 614 #endif | |
| 615 | |
| 616 MockWebSpeechRecognizer* WebTestProxyBase::speechRecognizerMock() | 599 MockWebSpeechRecognizer* WebTestProxyBase::speechRecognizerMock() |
| 617 { | 600 { |
| 618 if (!m_speechRecognizer.get()) { | 601 if (!m_speechRecognizer.get()) { |
| 619 m_speechRecognizer.reset(new MockWebSpeechRecognizer()); | 602 m_speechRecognizer.reset(new MockWebSpeechRecognizer()); |
| 620 m_speechRecognizer->setDelegate(m_delegate); | 603 m_speechRecognizer->setDelegate(m_delegate); |
| 621 } | 604 } |
| 622 return m_speechRecognizer.get(); | 605 return m_speechRecognizer.get(); |
| 623 } | 606 } |
| 624 | 607 |
| 625 void WebTestProxyBase::didInvalidateRect(const WebRect& rect) | 608 void WebTestProxyBase::didInvalidateRect(const WebRect& rect) |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 WebNotificationPresenter* WebTestProxyBase::notificationPresenter() | 876 WebNotificationPresenter* WebTestProxyBase::notificationPresenter() |
| 894 { | 877 { |
| 895 return m_testInterfaces->testRunner()->notification_presenter(); | 878 return m_testInterfaces->testRunner()->notification_presenter(); |
| 896 } | 879 } |
| 897 | 880 |
| 898 WebMIDIClient* WebTestProxyBase::webMIDIClient() | 881 WebMIDIClient* WebTestProxyBase::webMIDIClient() |
| 899 { | 882 { |
| 900 return midiClientMock(); | 883 return midiClientMock(); |
| 901 } | 884 } |
| 902 | 885 |
| 903 WebSpeechInputController* WebTestProxyBase::speechInputController(WebSpeechInput
Listener* listener) | |
| 904 { | |
| 905 #if ENABLE_INPUT_SPEECH | |
| 906 if (!m_speechInputController.get()) { | |
| 907 m_speechInputController.reset(new MockWebSpeechInputController(listener)
); | |
| 908 m_speechInputController->setDelegate(m_delegate); | |
| 909 } | |
| 910 return m_speechInputController.get(); | |
| 911 #else | |
| 912 DCHECK(listener); | |
| 913 return 0; | |
| 914 #endif | |
| 915 } | |
| 916 | |
| 917 WebSpeechRecognizer* WebTestProxyBase::speechRecognizer() | 886 WebSpeechRecognizer* WebTestProxyBase::speechRecognizer() |
| 918 { | 887 { |
| 919 return speechRecognizerMock(); | 888 return speechRecognizerMock(); |
| 920 } | 889 } |
| 921 | 890 |
| 922 bool WebTestProxyBase::requestPointerLock() | 891 bool WebTestProxyBase::requestPointerLock() |
| 923 { | 892 { |
| 924 return m_testInterfaces->testRunner()->RequestPointerLock(); | 893 return m_testInterfaces->testRunner()->RequestPointerLock(); |
| 925 } | 894 } |
| 926 | 895 |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1292 | 1261 |
| 1293 void WebTestProxyBase::resetInputMethod() | 1262 void WebTestProxyBase::resetInputMethod() |
| 1294 { | 1263 { |
| 1295 // If a composition text exists, then we need to let the browser process | 1264 // If a composition text exists, then we need to let the browser process |
| 1296 // to cancel the input method's ongoing composition session. | 1265 // to cancel the input method's ongoing composition session. |
| 1297 if (m_webWidget) | 1266 if (m_webWidget) |
| 1298 m_webWidget->confirmComposition(); | 1267 m_webWidget->confirmComposition(); |
| 1299 } | 1268 } |
| 1300 | 1269 |
| 1301 } // namespace content | 1270 } // namespace content |
| OLD | NEW |