Commit 68527db2 authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Remove unused MockAudioDeviceFactory class

This is phase 4 on the design document [1].

[1] https://docs.google.com/document/d/19Zk6Fv1E-6QTQ2c33rpBjDNEkzlsSKvjb3hWkvZAE80/

BUG=787252
R=guidou@chromium.org, haraken@chromium.org

Change-Id: If7d88ea6be23d46dd78a9c9bbdc564762ae86a80
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2435922Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Commit-Queue: Antonio Gomes (GMT-4) <tonikitoo@igalia.com>
Cr-Commit-Position: refs/heads/master@{#811342}
parent 99d6f660
// Copyright 2016 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.
#include "content/renderer/media/audio/mock_audio_device_factory.h"
namespace content {
MockCapturerSource::MockCapturerSource() {}
MockCapturerSource::~MockCapturerSource() {}
void MockCapturerSource::SetVolume(double volume) {}
void MockCapturerSource::SetOutputDeviceForAec(
const std::string& output_device_id) {}
MockAudioDeviceFactory::MockAudioDeviceFactory()
: mock_capturer_source_(new MockCapturerSource()),
did_create_once_(false) {}
MockAudioDeviceFactory::~MockAudioDeviceFactory() {}
scoped_refptr<media::AudioCapturerSource>
MockAudioDeviceFactory::CreateAudioCapturerSource(
const blink::LocalFrameToken& frame_token,
const media::AudioSourceParameters& params) {
CHECK(!did_create_once_);
did_create_once_ = true;
return scoped_refptr<media::AudioCapturerSource>(mock_capturer_source_);
}
} // namespace content
// Copyright 2016 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 CONTENT_RENDERER_MEDIA_AUDIO_MOCK_AUDIO_DEVICE_FACTORY_H_
#define CONTENT_RENDERER_MEDIA_AUDIO_MOCK_AUDIO_DEVICE_FACTORY_H_
#include <string>
#include "media/base/audio_capturer_source.h"
#include "media/base/audio_renderer_sink.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "third_party/blink/public/common/tokens/tokens.h"
#include "third_party/blink/public/web/modules/media/audio/web_audio_device_factory.h"
namespace content {
// MockAudioDeviceFactory creates an instance of this.
class MockCapturerSource : public media::AudioCapturerSource {
public:
MockCapturerSource();
MOCK_METHOD2(Initialize,
void(const media::AudioParameters& params,
CaptureCallback* callback));
MOCK_METHOD0(Start, void());
MOCK_METHOD0(Stop, void());
MOCK_METHOD1(SetAutomaticGainControl, void(bool enable));
void SetVolume(double volume) override;
void SetOutputDeviceForAec(const std::string& output_device_id) override;
protected:
~MockCapturerSource() override;
};
// Creates one MockCapturerSource instance for unit testing. This replaces the
// need for unit tests to open a real platform audio output. Instantiating this
// class sets the global content::AudioDeviceFactory implementation to |this|.
class MockAudioDeviceFactory : public blink::WebAudioDeviceFactory {
public:
MockAudioDeviceFactory();
~MockAudioDeviceFactory() override;
// Returns the MockCapturerSource created by this factory.
const scoped_refptr<MockCapturerSource>& mock_capturer_source() const {
return mock_capturer_source_;
}
// These methods are just mocked because tests currently don't need them to be
// implemented.
MOCK_METHOD3(CreateFinalAudioRendererSink,
scoped_refptr<media::AudioRendererSink>(
const blink::LocalFrameToken& frame_token,
const media::AudioSinkParameters& params,
base::TimeDelta auth_timeout));
MOCK_METHOD3(CreateAudioRendererSink,
scoped_refptr<media::AudioRendererSink>(
blink::WebAudioDeviceSourceType source_type,
const blink::LocalFrameToken& frame_token,
const media::AudioSinkParameters& params));
MOCK_METHOD3(CreateSwitchableAudioRendererSink,
scoped_refptr<media::SwitchableAudioRendererSink>(
blink::WebAudioDeviceSourceType source_type,
const blink::LocalFrameToken& frame_token,
const media::AudioSinkParameters& params));
// Returns mock_capturer_source_ once. If called a second time, the process
// will crash.
scoped_refptr<media::AudioCapturerSource> CreateAudioCapturerSource(
const blink::LocalFrameToken& frame_token,
const media::AudioSourceParameters& params) override;
private:
scoped_refptr<MockCapturerSource> mock_capturer_source_;
bool did_create_once_;
DISALLOW_COPY_AND_ASSIGN(MockAudioDeviceFactory);
};
} // namespace content
#endif // CONTENT_RENDERER_MEDIA_AUDIO_MOCK_AUDIO_DEVICE_FACTORY_H_
......@@ -2057,8 +2057,6 @@ test("content_unittests") {
"../renderer/loader/test_request_peer.h",
"../renderer/loader/url_loader_client_impl_unittest.cc",
"../renderer/loader/web_url_loader_impl_unittest.cc",
"../renderer/media/audio/mock_audio_device_factory.cc",
"../renderer/media/audio/mock_audio_device_factory.h",
"../renderer/media/batching_media_log_unittest.cc",
"../renderer/media/inspector_media_event_handler_unittest.cc",
"../renderer/media/power_status_helper_impl_unittest.cc",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment