#include "content/browser/speech/soda_speech_recognition_engine_impl.h"
#include <memory>
#include <vector>
#include "base/containers/queue.h"
#include "base/run_loop.h"
#include "content/browser/speech/fake_speech_recognition_manager_delegate.h"
#include "content/browser/speech/speech_recognition_engine.h"
#include "content/browser/speech/speech_recognizer_impl.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_browser_context.h"
#include "media/mojo/mojom/audio_data.mojom.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
const char kFirstSpeechResult[] = …;
const char kSecondSpeechResult[] = …;
}
_;
namespace content {
class SodaSpeechRecognitionEngineImplTest
: public testing::Test,
public SpeechRecognitionEngine::Delegate { … };
void SodaSpeechRecognitionEngineImplTest::SetUp() { … }
void SodaSpeechRecognitionEngineImplTest::TearDown() { … }
void SodaSpeechRecognitionEngineImplTest::OnSpeechRecognitionEngineResults(
const std::vector<media::mojom::WebSpeechRecognitionResultPtr>& results) { … }
void SodaSpeechRecognitionEngineImplTest::
OnSpeechRecognitionEngineEndOfUtterance() { … }
void SodaSpeechRecognitionEngineImplTest::OnSpeechRecognitionEngineError(
const media::mojom::SpeechRecognitionError& error) { … }
std::unique_ptr<SodaSpeechRecognitionEngineImpl>
SodaSpeechRecognitionEngineImplTest::CreateSpeechRecognition(
SpeechRecognitionSessionConfig config,
SpeechRecognitionManagerDelegate* speech_recognition_mgr_delegate,
bool set_ready_cb) { … }
void SodaSpeechRecognitionEngineImplTest::SendDummyAudioChunk() { … }
void SodaSpeechRecognitionEngineImplTest::FillRecognitionExpectResults(
std::vector<media::mojom::WebSpeechRecognitionResultPtr>& results,
const char* transcription,
bool is_final) { … }
void SodaSpeechRecognitionEngineImplTest::SendSpeechResult(const char* result,
bool is_final) { … }
void SodaSpeechRecognitionEngineImplTest::SendTranscriptionError() { … }
void SodaSpeechRecognitionEngineImplTest::ExpectResultsReceived(
const std::vector<media::mojom::WebSpeechRecognitionResultPtr>& results) { … }
bool SodaSpeechRecognitionEngineImplTest::ResultsAreEqual(
const std::vector<media::mojom::WebSpeechRecognitionResultPtr>& a,
const std::vector<media::mojom::WebSpeechRecognitionResultPtr>& b) { … }
TEST_F(SodaSpeechRecognitionEngineImplTest, SpeechRecognitionResults) { … }
TEST_F(SodaSpeechRecognitionEngineImplTest, SpeechRecognitionAudioChunksEnded) { … }
TEST_F(SodaSpeechRecognitionEngineImplTest, SpeechRecognitionEndOfUtterance) { … }
TEST_F(SodaSpeechRecognitionEngineImplTest, SpeechRecognitionEnd) { … }
TEST_F(SodaSpeechRecognitionEngineImplTest, SetOnReadyCallbackAfterBind) { … }
}