Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Side by Side Diff: content/shell/renderer/test_runner/MockWebSpeechInputController.h

Issue 110533009: Import TestRunner library into chromium. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MockWebSpeechInputController_h
6 #define MockWebSpeechInputController_h
7
8 #include <map>
9 #include <string>
10 #include <vector>
11
12 #include "content/shell/renderer/test_runner/TestCommon.h"
13 #include "content/shell/renderer/test_runner/WebTask.h"
14 #include "third_party/WebKit/public/platform/WebNonCopyable.h"
15 #include "third_party/WebKit/public/platform/WebRect.h"
16 #include "third_party/WebKit/public/web/WebSpeechInputController.h"
17 #include "third_party/WebKit/public/web/WebSpeechInputResult.h"
18
19 namespace blink {
20 class WebSecurityOrigin;
21 class WebSpeechInputListener;
22 class WebString;
23 }
24
25 namespace WebTestRunner {
26
27 class WebTestDelegate;
28
29 class MockWebSpeechInputController : public blink::WebSpeechInputController, pub lic blink::WebNonCopyable {
30 public:
31 explicit MockWebSpeechInputController(blink::WebSpeechInputListener*);
32 ~MockWebSpeechInputController();
33
34 void addMockRecognitionResult(const blink::WebString& result, double confide nce, const blink::WebString& language);
35 void setDumpRect(bool);
36 void clearResults();
37 void setDelegate(WebTestDelegate*);
38
39 // WebSpeechInputController implementation:
40 virtual bool startRecognition(int requestId, const blink::WebRect& elementRe ct, const blink::WebString& language, const blink::WebString& grammar, const bli nk::WebSecurityOrigin&) OVERRIDE;
41 virtual void cancelRecognition(int requestId) OVERRIDE;
42 virtual void stopRecording(int requestId) OVERRIDE;
43
44 WebTaskList* taskList() { return &m_taskList; }
45
46 private:
47 void speechTaskFired();
48
49 class SpeechTask : public WebMethodTask<MockWebSpeechInputController> {
50 public:
51 SpeechTask(MockWebSpeechInputController*);
52 void stop();
53
54 private:
55 virtual void runIfValid() OVERRIDE;
56 };
57
58 blink::WebSpeechInputListener* m_listener;
59
60 WebTaskList m_taskList;
61 SpeechTask* m_speechTask;
62
63 bool m_recording;
64 int m_requestId;
65 blink::WebRect m_requestRect;
66 std::string m_language;
67
68 std::map<std::string, std::vector<blink::WebSpeechInputResult> > m_recogniti onResults;
69 std::vector<blink::WebSpeechInputResult> m_resultsForEmptyLanguage;
70 bool m_dumpRect;
71
72 WebTestDelegate* m_delegate;
73 };
74
75 }
76
77 #endif // MockWebSpeechInputController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698