chromium/content/browser/speech/fake_speech_recognition_manager_delegate.cc

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/speech/fake_speech_recognition_manager_delegate.h"

#include "base/notimplemented.h"
#include "base/run_loop.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/speech_recognition_manager_delegate.h"
#include "media/mojo/mojom/audio_data.mojom.h"
#include "media/mojo/mojom/speech_recognition.mojom.h"
#include "media/mojo/mojom/speech_recognition_service.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace content {

MockSodaInstaller::MockSodaInstaller() = default;

MockSodaInstaller::~MockSodaInstaller() = default;

MockOnDeviceWebSpeechRecognitionService::
    MockOnDeviceWebSpeechRecognitionService(
        content::BrowserContext* browser_context)
    :{}

MockOnDeviceWebSpeechRecognitionService::
    ~MockOnDeviceWebSpeechRecognitionService() = default;

// SpeechRecognitionService
void MockOnDeviceWebSpeechRecognitionService::BindSpeechRecognitionContext(
    mojo::PendingReceiver<media::mojom::SpeechRecognitionContext> receiver) {}

// media::mojom::SpeechRecognitionContext:
void MockOnDeviceWebSpeechRecognitionService::BindRecognizer(
    mojo::PendingReceiver<media::mojom::SpeechRecognitionRecognizer> receiver,
    mojo::PendingRemote<media::mojom::SpeechRecognitionRecognizerClient> client,
    media::mojom::SpeechRecognitionOptionsPtr options,
    BindRecognizerCallback callback) {}

void MockOnDeviceWebSpeechRecognitionService::BindWebSpeechRecognizer(
    mojo::PendingReceiver<media::mojom::SpeechRecognitionSession>
        session_receiver,
    mojo::PendingRemote<media::mojom::SpeechRecognitionSessionClient>
        session_client,
    mojo::PendingReceiver<media::mojom::SpeechRecognitionAudioForwarder>
        audio_forwarder,
    int channel_count,
    int sample_rate,
    media::mojom::SpeechRecognitionOptionsPtr options,
    bool continuous) {}

// media::mojom::SpeechRecognitionRecognizer:
void MockOnDeviceWebSpeechRecognitionService::MarkDone() {}

// Methods for testing plumbing to SpeechRecognitionRecognizerClient.
void MockOnDeviceWebSpeechRecognitionService::SendSpeechRecognitionResult(
    const media::SpeechRecognitionResult& result) {}

void MockOnDeviceWebSpeechRecognitionService::SendSpeechRecognitionError() {}

void MockOnDeviceWebSpeechRecognitionService::OnRecognizerClientDisconnected() {}

void MockOnDeviceWebSpeechRecognitionService::
    OnSpeechRecognitionRecognitionEventCallback(bool success) {}

// SpeechRecognitionManagerDelegate
void FakeSpeechRecognitionManagerDelegate::CheckRecognitionIsAllowed(
    int session_id,
    base::OnceCallback<void(bool ask_user, bool is_allowed)> callback) {}

SpeechRecognitionEventListener*
FakeSpeechRecognitionManagerDelegate::GetEventListener() {}

void FakeSpeechRecognitionManagerDelegate::BindSpeechRecognitionContext(
    mojo::PendingReceiver<media::mojom::SpeechRecognitionContext> receiver) {}

void FakeSpeechRecognitionManagerDelegate::Reset(
    MockOnDeviceWebSpeechRecognitionService* service) {}

}  // namespace content