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 #ifndef COMPONENTS_TEST_RUNNER_MOCK_WEB_SPEECH_RECOGNIZER_H_ | 5 #ifndef COMPONENTS_TEST_RUNNER_MOCK_WEB_SPEECH_RECOGNIZER_H_ |
6 #define COMPONENTS_TEST_RUNNER_MOCK_WEB_SPEECH_RECOGNIZER_H_ | 6 #define COMPONENTS_TEST_RUNNER_MOCK_WEB_SPEECH_RECOGNIZER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "components/test_runner/web_task.h" | 12 #include "components/test_runner/web_task.h" |
13 #include "third_party/WebKit/public/web/WebSpeechRecognizer.h" | 13 #include "third_party/WebKit/public/web/WebSpeechRecognizer.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 class WebSpeechRecognitionHandle; | 16 class WebSpeechRecognitionHandle; |
17 class WebSpeechRecognitionParams; | 17 class WebSpeechRecognitionParams; |
18 class WebSpeechRecognizerClient; | 18 class WebSpeechRecognizerClient; |
19 class WebString; | 19 class WebString; |
20 } | 20 } |
21 | 21 |
22 namespace test_runner { | 22 namespace test_runner { |
23 | 23 |
24 class WebTestDelegate; | 24 class WebTestDelegate; |
25 | 25 |
26 class MockWebSpeechRecognizer : public blink::WebSpeechRecognizer { | 26 class MockWebSpeechRecognizer : public blink::WebSpeechRecognizer { |
27 public: | 27 public: |
28 MockWebSpeechRecognizer(); | 28 MockWebSpeechRecognizer(); |
29 virtual ~MockWebSpeechRecognizer(); | 29 ~MockWebSpeechRecognizer() override; |
30 | 30 |
31 void SetDelegate(WebTestDelegate* delegate); | 31 void SetDelegate(WebTestDelegate* delegate); |
32 | 32 |
33 // WebSpeechRecognizer implementation: | 33 // WebSpeechRecognizer implementation: |
34 virtual void start(const blink::WebSpeechRecognitionHandle& handle, | 34 void start(const blink::WebSpeechRecognitionHandle& handle, |
35 const blink::WebSpeechRecognitionParams& params, | 35 const blink::WebSpeechRecognitionParams& params, |
36 blink::WebSpeechRecognizerClient* client); | 36 blink::WebSpeechRecognizerClient* client) override; |
37 virtual void stop(const blink::WebSpeechRecognitionHandle& handle, | 37 void stop(const blink::WebSpeechRecognitionHandle& handle, |
38 blink::WebSpeechRecognizerClient* client); | 38 blink::WebSpeechRecognizerClient* client) override; |
39 virtual void abort(const blink::WebSpeechRecognitionHandle& handle, | 39 void abort(const blink::WebSpeechRecognitionHandle& handle, |
40 blink::WebSpeechRecognizerClient* client); | 40 blink::WebSpeechRecognizerClient* client) override; |
41 | 41 |
42 // Methods accessed by layout tests: | 42 // Methods accessed by layout tests: |
43 void AddMockResult(const blink::WebString& transcript, float confidence); | 43 void AddMockResult(const blink::WebString& transcript, float confidence); |
44 void SetError(const blink::WebString& error, const blink::WebString& message); | 44 void SetError(const blink::WebString& error, const blink::WebString& message); |
45 bool WasAborted() const { return was_aborted_; } | 45 bool WasAborted() const { return was_aborted_; } |
46 | 46 |
47 // Methods accessed from Task objects: | 47 // Methods accessed from Task objects: |
48 blink::WebSpeechRecognizerClient* Client() { return client_; } | 48 blink::WebSpeechRecognizerClient* Client() { return client_; } |
49 blink::WebSpeechRecognitionHandle& Handle() { return handle_; } | 49 blink::WebSpeechRecognitionHandle& Handle() { return handle_; } |
50 WebTaskList* mutable_task_list() { return &task_list_; } | 50 WebTaskList* mutable_task_list() { return &task_list_; } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 private: | 89 private: |
90 DISALLOW_COPY_AND_ASSIGN(StepTask); | 90 DISALLOW_COPY_AND_ASSIGN(StepTask); |
91 }; | 91 }; |
92 | 92 |
93 DISALLOW_COPY_AND_ASSIGN(MockWebSpeechRecognizer); | 93 DISALLOW_COPY_AND_ASSIGN(MockWebSpeechRecognizer); |
94 }; | 94 }; |
95 | 95 |
96 } // namespace test_runner | 96 } // namespace test_runner |
97 | 97 |
98 #endif // COMPONENTS_TEST_RUNNER_MOCK_WEB_SPEECH_RECOGNIZER_H_ | 98 #endif // COMPONENTS_TEST_RUNNER_MOCK_WEB_SPEECH_RECOGNIZER_H_ |
OLD | NEW |