| 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/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 39 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| 40 #include "third_party/WebKit/public/web/WebAXEnums.h" | 40 #include "third_party/WebKit/public/web/WebAXEnums.h" |
| 41 #include "third_party/WebKit/public/web/WebAXObject.h" | 41 #include "third_party/WebKit/public/web/WebAXObject.h" |
| 42 #include "third_party/WebKit/public/web/WebCachedURLRequest.h" | 42 #include "third_party/WebKit/public/web/WebCachedURLRequest.h" |
| 43 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 43 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
| 44 #include "third_party/WebKit/public/web/WebDataSource.h" | 44 #include "third_party/WebKit/public/web/WebDataSource.h" |
| 45 #include "third_party/WebKit/public/web/WebDocument.h" | 45 #include "third_party/WebKit/public/web/WebDocument.h" |
| 46 #include "third_party/WebKit/public/web/WebElement.h" | 46 #include "third_party/WebKit/public/web/WebElement.h" |
| 47 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 47 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
| 48 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 48 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 49 #include "third_party/WebKit/public/web/WebMIDIClientMock.h" | |
| 50 #include "third_party/WebKit/public/web/WebNode.h" | 49 #include "third_party/WebKit/public/web/WebNode.h" |
| 51 #include "third_party/WebKit/public/web/WebPagePopup.h" | 50 #include "third_party/WebKit/public/web/WebPagePopup.h" |
| 52 #include "third_party/WebKit/public/web/WebPluginParams.h" | 51 #include "third_party/WebKit/public/web/WebPluginParams.h" |
| 53 #include "third_party/WebKit/public/web/WebPrintParams.h" | 52 #include "third_party/WebKit/public/web/WebPrintParams.h" |
| 54 #include "third_party/WebKit/public/web/WebRange.h" | 53 #include "third_party/WebKit/public/web/WebRange.h" |
| 55 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" | 54 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" |
| 56 #include "third_party/WebKit/public/web/WebView.h" | 55 #include "third_party/WebKit/public/web/WebView.h" |
| 57 #include "third_party/WebKit/public/web/WebWidgetClient.h" | 56 #include "third_party/WebKit/public/web/WebWidgetClient.h" |
| 58 | 57 |
| 59 namespace content { | 58 namespace content { |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 // TestRunner does not support popup widgets. So |web_widget|_ is always a | 399 // TestRunner does not support popup widgets. So |web_widget|_ is always a |
| 401 // WebView. | 400 // WebView. |
| 402 return static_cast<blink::WebView*>(web_widget_); | 401 return static_cast<blink::WebView*>(web_widget_); |
| 403 } | 402 } |
| 404 | 403 |
| 405 void WebTestProxyBase::Reset() { | 404 void WebTestProxyBase::Reset() { |
| 406 drag_image_.reset(); | 405 drag_image_.reset(); |
| 407 animate_scheduled_ = false; | 406 animate_scheduled_ = false; |
| 408 resource_identifier_map_.clear(); | 407 resource_identifier_map_.clear(); |
| 409 log_console_output_ = true; | 408 log_console_output_ = true; |
| 410 if (midi_client_.get()) | |
| 411 midi_client_->resetMock(); | |
| 412 accept_languages_ = ""; | 409 accept_languages_ = ""; |
| 413 } | 410 } |
| 414 | 411 |
| 415 blink::WebSpellCheckClient* WebTestProxyBase::GetSpellCheckClient() const { | 412 blink::WebSpellCheckClient* WebTestProxyBase::GetSpellCheckClient() const { |
| 416 return spellcheck_.get(); | 413 return spellcheck_.get(); |
| 417 } | 414 } |
| 418 | 415 |
| 419 blink::WebColorChooser* WebTestProxyBase::CreateColorChooser( | 416 blink::WebColorChooser* WebTestProxyBase::CreateColorChooser( |
| 420 blink::WebColorChooserClient* client, | 417 blink::WebColorChooserClient* client, |
| 421 const blink::WebColor& color, | 418 const blink::WebColor& color, |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 } | 668 } |
| 672 | 669 |
| 673 MockScreenOrientationClient* | 670 MockScreenOrientationClient* |
| 674 WebTestProxyBase::GetScreenOrientationClientMock() { | 671 WebTestProxyBase::GetScreenOrientationClientMock() { |
| 675 if (!screen_orientation_client_.get()) { | 672 if (!screen_orientation_client_.get()) { |
| 676 screen_orientation_client_.reset(new MockScreenOrientationClient); | 673 screen_orientation_client_.reset(new MockScreenOrientationClient); |
| 677 } | 674 } |
| 678 return screen_orientation_client_.get(); | 675 return screen_orientation_client_.get(); |
| 679 } | 676 } |
| 680 | 677 |
| 681 blink::WebMIDIClientMock* WebTestProxyBase::GetMIDIClientMock() { | |
| 682 if (!midi_client_.get()) | |
| 683 midi_client_.reset(new blink::WebMIDIClientMock); | |
| 684 return midi_client_.get(); | |
| 685 } | |
| 686 | |
| 687 MockWebSpeechRecognizer* WebTestProxyBase::GetSpeechRecognizerMock() { | 678 MockWebSpeechRecognizer* WebTestProxyBase::GetSpeechRecognizerMock() { |
| 688 if (!speech_recognizer_.get()) { | 679 if (!speech_recognizer_.get()) { |
| 689 speech_recognizer_.reset(new MockWebSpeechRecognizer()); | 680 speech_recognizer_.reset(new MockWebSpeechRecognizer()); |
| 690 speech_recognizer_->SetDelegate(delegate_); | 681 speech_recognizer_->SetDelegate(delegate_); |
| 691 } | 682 } |
| 692 return speech_recognizer_.get(); | 683 return speech_recognizer_.get(); |
| 693 } | 684 } |
| 694 | 685 |
| 695 MockCredentialManagerClient* | 686 MockCredentialManagerClient* |
| 696 WebTestProxyBase::GetCredentialManagerClientMock() { | 687 WebTestProxyBase::GetCredentialManagerClientMock() { |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 // Simulate a print by going into print mode and then exit straight away. | 922 // Simulate a print by going into print mode and then exit straight away. |
| 932 void WebTestProxyBase::PrintPage(blink::WebLocalFrame* frame) { | 923 void WebTestProxyBase::PrintPage(blink::WebLocalFrame* frame) { |
| 933 blink::WebSize page_size_in_pixels = web_widget_->size(); | 924 blink::WebSize page_size_in_pixels = web_widget_->size(); |
| 934 if (page_size_in_pixels.isEmpty()) | 925 if (page_size_in_pixels.isEmpty()) |
| 935 return; | 926 return; |
| 936 blink::WebPrintParams printParams(page_size_in_pixels); | 927 blink::WebPrintParams printParams(page_size_in_pixels); |
| 937 frame->printBegin(printParams); | 928 frame->printBegin(printParams); |
| 938 frame->printEnd(); | 929 frame->printEnd(); |
| 939 } | 930 } |
| 940 | 931 |
| 941 blink::WebMIDIClient* WebTestProxyBase::GetWebMIDIClient() { | |
| 942 return GetMIDIClientMock(); | |
| 943 } | |
| 944 | |
| 945 blink::WebSpeechRecognizer* WebTestProxyBase::GetSpeechRecognizer() { | 932 blink::WebSpeechRecognizer* WebTestProxyBase::GetSpeechRecognizer() { |
| 946 return GetSpeechRecognizerMock(); | 933 return GetSpeechRecognizerMock(); |
| 947 } | 934 } |
| 948 | 935 |
| 949 bool WebTestProxyBase::RequestPointerLock() { | 936 bool WebTestProxyBase::RequestPointerLock() { |
| 950 return test_interfaces_->GetTestRunner()->RequestPointerLock(); | 937 return test_interfaces_->GetTestRunner()->RequestPointerLock(); |
| 951 } | 938 } |
| 952 | 939 |
| 953 void WebTestProxyBase::RequestPointerUnlock() { | 940 void WebTestProxyBase::RequestPointerUnlock() { |
| 954 test_interfaces_->GetTestRunner()->RequestPointerUnlock(); | 941 test_interfaces_->GetTestRunner()->RequestPointerUnlock(); |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 // to cancel the input method's ongoing composition session. | 1366 // to cancel the input method's ongoing composition session. |
| 1380 if (web_widget_) | 1367 if (web_widget_) |
| 1381 web_widget_->confirmComposition(); | 1368 web_widget_->confirmComposition(); |
| 1382 } | 1369 } |
| 1383 | 1370 |
| 1384 blink::WebString WebTestProxyBase::acceptLanguages() { | 1371 blink::WebString WebTestProxyBase::acceptLanguages() { |
| 1385 return blink::WebString::fromUTF8(accept_languages_); | 1372 return blink::WebString::fromUTF8(accept_languages_); |
| 1386 } | 1373 } |
| 1387 | 1374 |
| 1388 } // namespace content | 1375 } // namespace content |
| OLD | NEW |