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

Unified Diff: components/copresence/test/audio_test_support.cc

Issue 637223011: Redesign the copresence audio handlers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Created 6 years, 2 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/copresence/test/audio_test_support.cc
diff --git a/components/copresence/test/audio_test_support.cc b/components/copresence/test/audio_test_support.cc
index b1913119e5fedbd364662cf592ea220286d11e66..98548c580644607d6d84c4644b126f734dba1654 100644
--- a/components/copresence/test/audio_test_support.cc
+++ b/components/copresence/test/audio_test_support.cc
@@ -34,4 +34,51 @@ CreateRandomAudioRefCounted(int random_seed, int channels, int samples) {
return bus;
}
+// TestAudioPlayer implementation.
+TestAudioPlayer::TestAudioPlayer() : is_playing_(false) {
+}
+TestAudioPlayer::~TestAudioPlayer() {
+}
+void TestAudioPlayer::Initialize() {
+}
+void TestAudioPlayer::Play(
+ const scoped_refptr<media::AudioBusRefCounted>& /* samples */) {
+ is_playing_ = true;
+}
+void TestAudioPlayer::Stop() {
+ is_playing_ = false;
+}
+void TestAudioPlayer::Finalize() {
+ delete this;
+}
+bool TestAudioPlayer::IsPlaying() {
+ return is_playing_;
+}
+
+// TestAudioRecorder implementation.
+TestAudioRecorder::TestAudioRecorder()
+ : AudioRecorderImpl(), is_recording_(false) {
+}
+TestAudioRecorder::~TestAudioRecorder() {
+}
+void TestAudioRecorder::Initialize(const RecordedSamplesCallback& cb) {
+ cb_ = cb;
+}
+void TestAudioRecorder::Record() {
+ is_recording_ = true;
+}
+void TestAudioRecorder::Stop() {
+ is_recording_ = false;
+}
+void TestAudioRecorder::Finalize() {
+ delete this;
+}
+bool TestAudioRecorder::IsRecording() {
+ return is_recording_;
+}
+void TestAudioRecorder::TriggerDecodeRequest() {
+ if (!cb_.is_null())
+ cb_.Run(std::string(7, 0x1337));
+}
+
} // namespace copresence

Powered by Google App Engine
This is Rietveld 408576698