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

Side by Side Diff: components/audio_modem/audio_player_unittest.cc

Issue 865483005: Creating the audio_modem component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small fixes Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/copresence/mediums/audio/audio_player.h" 5 #include "components/audio_modem/audio_player.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "components/copresence/mediums/audio/audio_player_impl.h" 9 #include "components/audio_modem/audio_player_impl.h"
10 #include "components/copresence/public/copresence_constants.h" 10 #include "components/audio_modem/public/audio_modem_types.h"
11 #include "components/copresence/test/audio_test_support.h" 11 #include "components/audio_modem/test/random_samples.h"
12 #include "media/audio/audio_manager.h" 12 #include "media/audio/audio_manager.h"
13 #include "media/audio/audio_manager_base.h" 13 #include "media/audio/audio_manager_base.h"
14 #include "media/base/audio_bus.h" 14 #include "media/base/audio_bus.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 namespace { 17 namespace {
18 18
19 class TestAudioOutputStream : public media::AudioOutputStream { 19 class TestAudioOutputStream : public media::AudioOutputStream {
20 public: 20 public:
21 using GatherSamplesCallback = 21 using GatherSamplesCallback =
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 int max_frame_count_; 61 int max_frame_count_;
62 GatherSamplesCallback gather_callback_; 62 GatherSamplesCallback gather_callback_;
63 AudioSourceCallback* callback_; 63 AudioSourceCallback* callback_;
64 base::MessageLoop* caller_loop_; 64 base::MessageLoop* caller_loop_;
65 65
66 DISALLOW_COPY_AND_ASSIGN(TestAudioOutputStream); 66 DISALLOW_COPY_AND_ASSIGN(TestAudioOutputStream);
67 }; 67 };
68 68
69 } // namespace 69 } // namespace
70 70
71 namespace copresence { 71 namespace audio_modem {
72 72
73 class AudioPlayerTest : public testing::Test, 73 class AudioPlayerTest : public testing::Test,
74 public base::SupportsWeakPtr<AudioPlayerTest> { 74 public base::SupportsWeakPtr<AudioPlayerTest> {
75 public: 75 public:
76 AudioPlayerTest() : buffer_index_(0), player_(nullptr) { 76 AudioPlayerTest() : buffer_index_(0), player_(nullptr) {
77 if (!media::AudioManager::Get()) 77 if (!media::AudioManager::Get())
78 media::AudioManager::CreateForTesting(); 78 media::AudioManager::CreateForTesting();
79 } 79 }
80 80
81 ~AudioPlayerTest() override { DeletePlayer(); } 81 ~AudioPlayerTest() override { DeletePlayer(); }
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 PlayAndVerifySamples(CreateRandomAudioRefCounted(0x1337, 1, kNumSamples)); 201 PlayAndVerifySamples(CreateRandomAudioRefCounted(0x1337, 1, kNumSamples));
202 202
203 PlayAndVerifySamples( 203 PlayAndVerifySamples(
204 CreateRandomAudioRefCounted(0x7331, 1, kNumSamples - 3123)); 204 CreateRandomAudioRefCounted(0x7331, 1, kNumSamples - 3123));
205 205
206 PlayAndVerifySamples(CreateRandomAudioRefCounted(0xf00d, 1, kNumSamples * 2)); 206 PlayAndVerifySamples(CreateRandomAudioRefCounted(0xf00d, 1, kNumSamples * 2));
207 207
208 DeletePlayer(); 208 DeletePlayer();
209 } 209 }
210 210
211 } // namespace copresence 211 } // namespace audio_modem
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698