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

Unified Diff: components/test_runner/mock_web_speech_recognizer.h

Issue 2707183003: Move //components/test_runner back into //content/shell (Closed)
Patch Set: Trim DEPS Created 3 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: components/test_runner/mock_web_speech_recognizer.h
diff --git a/components/test_runner/mock_web_speech_recognizer.h b/components/test_runner/mock_web_speech_recognizer.h
deleted file mode 100644
index a25ea32af0829a75cfe36728324ddd3f1a1d9f58..0000000000000000000000000000000000000000
--- a/components/test_runner/mock_web_speech_recognizer.h
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_TEST_RUNNER_MOCK_WEB_SPEECH_RECOGNIZER_H_
-#define COMPONENTS_TEST_RUNNER_MOCK_WEB_SPEECH_RECOGNIZER_H_
-
-#include <deque>
-#include <vector>
-
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "third_party/WebKit/public/web/WebSpeechRecognizer.h"
-
-namespace blink {
-class WebSpeechRecognitionHandle;
-class WebSpeechRecognitionParams;
-class WebSpeechRecognizerClient;
-class WebString;
-}
-
-namespace test_runner {
-
-class WebTestDelegate;
-
-class MockWebSpeechRecognizer : public blink::WebSpeechRecognizer {
- public:
- MockWebSpeechRecognizer();
- ~MockWebSpeechRecognizer() override;
-
- void SetDelegate(WebTestDelegate* delegate);
-
- // WebSpeechRecognizer implementation:
- void start(const blink::WebSpeechRecognitionHandle& handle,
- const blink::WebSpeechRecognitionParams& params,
- blink::WebSpeechRecognizerClient* client) override;
- void stop(const blink::WebSpeechRecognitionHandle& handle,
- blink::WebSpeechRecognizerClient* client) override;
- void abort(const blink::WebSpeechRecognitionHandle& handle,
- blink::WebSpeechRecognizerClient* client) override;
-
- // Methods accessed by layout tests:
- void AddMockResult(const blink::WebString& transcript, float confidence);
- void SetError(const blink::WebString& error, const blink::WebString& message);
- bool WasAborted() const { return was_aborted_; }
-
- // Methods accessed from Task objects:
- blink::WebSpeechRecognizerClient* Client() { return client_; }
- blink::WebSpeechRecognitionHandle& Handle() { return handle_; }
-
- void SetClientContext(const blink::WebSpeechRecognitionHandle&,
- blink::WebSpeechRecognizerClient*);
-
- class Task {
- public:
- Task(MockWebSpeechRecognizer* recognizer) : recognizer_(recognizer) {}
- virtual ~Task() {}
- virtual void run() = 0;
- virtual bool isNewContextTask() const;
-
- protected:
- MockWebSpeechRecognizer* recognizer_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(Task);
- };
-
- private:
- void StartTaskQueue();
- void ClearTaskQueue();
- void PostRunTaskFromQueue();
- void RunTaskFromQueue();
-
- bool HasPendingNewContextTasks() const;
-
- blink::WebSpeechRecognitionHandle handle_;
- blink::WebSpeechRecognizerClient* client_;
- std::vector<blink::WebString> mock_transcripts_;
- std::vector<float> mock_confidences_;
- bool was_aborted_;
-
- // Queue of tasks to be run.
- std::deque<Task*> task_queue_;
- bool task_queue_running_;
-
- WebTestDelegate* delegate_;
-
- base::WeakPtrFactory<MockWebSpeechRecognizer> weak_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(MockWebSpeechRecognizer);
-};
-
-} // namespace test_runner
-
-#endif // COMPONENTS_TEST_RUNNER_MOCK_WEB_SPEECH_RECOGNIZER_H_

Powered by Google App Engine
This is Rietveld 408576698