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/test_runner.h" | 5 #include "content/shell/renderer/test_runner/test_runner.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "content/shell/common/test_runner/test_preferences.h" | 10 #include "content/shell/common/test_runner/test_preferences.h" |
11 #include "content/shell/renderer/test_runner/MockWebSpeechRecognizer.h" | |
12 #include "content/shell/renderer/test_runner/TestInterfaces.h" | 11 #include "content/shell/renderer/test_runner/TestInterfaces.h" |
13 #include "content/shell/renderer/test_runner/WebTestDelegate.h" | 12 #include "content/shell/renderer/test_runner/WebTestDelegate.h" |
14 #include "content/shell/renderer/test_runner/mock_web_push_client.h" | 13 #include "content/shell/renderer/test_runner/mock_web_push_client.h" |
| 14 #include "content/shell/renderer/test_runner/mock_web_speech_recognizer.h" |
15 #include "content/shell/renderer/test_runner/notification_presenter.h" | 15 #include "content/shell/renderer/test_runner/notification_presenter.h" |
16 #include "content/shell/renderer/test_runner/web_permissions.h" | 16 #include "content/shell/renderer/test_runner/web_permissions.h" |
17 #include "content/shell/renderer/test_runner/web_test_proxy.h" | 17 #include "content/shell/renderer/test_runner/web_test_proxy.h" |
18 #include "gin/arguments.h" | 18 #include "gin/arguments.h" |
19 #include "gin/array_buffer.h" | 19 #include "gin/array_buffer.h" |
20 #include "gin/handle.h" | 20 #include "gin/handle.h" |
21 #include "gin/object_template_builder.h" | 21 #include "gin/object_template_builder.h" |
22 #include "gin/wrappable.h" | 22 #include "gin/wrappable.h" |
23 #include "third_party/WebKit/public/platform/WebArrayBuffer.h" | 23 #include "third_party/WebKit/public/platform/WebArrayBuffer.h" |
24 #include "third_party/WebKit/public/platform/WebBatteryStatus.h" | 24 #include "third_party/WebKit/public/platform/WebBatteryStatus.h" |
(...skipping 2719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2744 bool permission_granted) { | 2744 bool permission_granted) { |
2745 notification_presenter_->GrantPermission(origin, permission_granted); | 2745 notification_presenter_->GrantPermission(origin, permission_granted); |
2746 } | 2746 } |
2747 | 2747 |
2748 bool TestRunner::SimulateWebNotificationClick(const std::string& value) { | 2748 bool TestRunner::SimulateWebNotificationClick(const std::string& value) { |
2749 return notification_presenter_->SimulateClick(value); | 2749 return notification_presenter_->SimulateClick(value); |
2750 } | 2750 } |
2751 | 2751 |
2752 void TestRunner::AddMockSpeechRecognitionResult(const std::string& transcript, | 2752 void TestRunner::AddMockSpeechRecognitionResult(const std::string& transcript, |
2753 double confidence) { | 2753 double confidence) { |
2754 proxy_->GetSpeechRecognizerMock()->addMockResult( | 2754 proxy_->GetSpeechRecognizerMock()->AddMockResult( |
2755 WebString::fromUTF8(transcript), confidence); | 2755 WebString::fromUTF8(transcript), confidence); |
2756 } | 2756 } |
2757 | 2757 |
2758 void TestRunner::SetMockSpeechRecognitionError(const std::string& error, | 2758 void TestRunner::SetMockSpeechRecognitionError(const std::string& error, |
2759 const std::string& message) { | 2759 const std::string& message) { |
2760 proxy_->GetSpeechRecognizerMock()->setError(WebString::fromUTF8(error), | 2760 proxy_->GetSpeechRecognizerMock()->SetError(WebString::fromUTF8(error), |
2761 WebString::fromUTF8(message)); | 2761 WebString::fromUTF8(message)); |
2762 } | 2762 } |
2763 | 2763 |
2764 bool TestRunner::WasMockSpeechRecognitionAborted() { | 2764 bool TestRunner::WasMockSpeechRecognitionAborted() { |
2765 return proxy_->GetSpeechRecognizerMock()->wasAborted(); | 2765 return proxy_->GetSpeechRecognizerMock()->WasAborted(); |
2766 } | 2766 } |
2767 | 2767 |
2768 void TestRunner::AddWebPageOverlay() { | 2768 void TestRunner::AddWebPageOverlay() { |
2769 if (web_view_ && !page_overlay_) { | 2769 if (web_view_ && !page_overlay_) { |
2770 page_overlay_ = new TestPageOverlay(web_view_); | 2770 page_overlay_ = new TestPageOverlay(web_view_); |
2771 web_view_->addPageOverlay(page_overlay_, 0); | 2771 web_view_->addPageOverlay(page_overlay_, 0); |
2772 } | 2772 } |
2773 } | 2773 } |
2774 | 2774 |
2775 void TestRunner::RemoveWebPageOverlay() { | 2775 void TestRunner::RemoveWebPageOverlay() { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2910 } | 2910 } |
2911 | 2911 |
2912 void TestRunner::DidLosePointerLockInternal() { | 2912 void TestRunner::DidLosePointerLockInternal() { |
2913 bool was_locked = pointer_locked_; | 2913 bool was_locked = pointer_locked_; |
2914 pointer_locked_ = false; | 2914 pointer_locked_ = false; |
2915 if (was_locked) | 2915 if (was_locked) |
2916 web_view_->didLosePointerLock(); | 2916 web_view_->didLosePointerLock(); |
2917 } | 2917 } |
2918 | 2918 |
2919 } // namespace content | 2919 } // namespace content |
OLD | NEW |