Chromium Code Reviews| Index: components/copresence/mediums/audio/audio_manager_unittest.cc |
| diff --git a/components/copresence/mediums/audio/audio_manager_unittest.cc b/components/copresence/mediums/audio/audio_manager_unittest.cc |
| index 5fcc6d861ae059f33185758bc76ffa97f2cfb2a7..bb835127b5712f3d59d25c0cdedbfaf2ea013d63 100644 |
| --- a/components/copresence/mediums/audio/audio_manager_unittest.cc |
| +++ b/components/copresence/mediums/audio/audio_manager_unittest.cc |
| @@ -9,9 +9,8 @@ |
| #include "components/copresence/mediums/audio/audio_manager_impl.h" |
| #include "components/copresence/mediums/audio/audio_player.h" |
| #include "components/copresence/mediums/audio/audio_recorder.h" |
| -#include "components/copresence/test/audio_test_support.h" |
| +#include "components/copresence/test/stub_whispernet_client.h" |
| #include "media/base/audio_bus.h" |
| -//#include "testing/gmock/include/gmock/gmock.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| namespace copresence { |
| @@ -71,21 +70,24 @@ class AudioManagerTest : public testing::Test { |
| audio_manager_->set_player_for_testing(INAUDIBLE, inaudible_player_); |
| audio_manager_->set_recorder_for_testing(recorder_); |
| audio_manager_->Initialize( |
| - base::Bind(&AudioManagerTest::DecodeSamples, base::Unretained(this)), |
| - base::Bind(&AudioManagerTest::EncodeToken, base::Unretained(this))); |
| + new StubWhispernetClient, |
|
Charlie
2014/11/06 17:28:23
Keep this in a local scoped_ptr. Otherwise it will
rkc
2014/11/06 19:58:24
Done.
|
| + base::Bind(&AudioManagerTest::GetTokens, base::Unretained(this))); |
| } |
| ~AudioManagerTest() override {} |
| protected: |
| - void EncodeToken(const std::string& token, |
| - AudioType audible, |
| - const AudioManager::SamplesCallback& callback) { |
| - callback.Run( |
| - token, audible, CreateRandomAudioRefCounted(0x1337, 1, 0x7331)); |
| - } |
| - |
| - void DecodeSamples(AudioType type, const std::string& /* samples */) { |
| - last_received_decode_type_ = type; |
| + void GetTokens(const std::vector<AudioToken>& tokens) { |
|
Charlie
2014/11/06 17:28:23
Shouldn't we start by setting last_received_decode
rkc
2014/11/06 19:58:24
Done.
|
| + for (const auto& token : tokens) { |
| + if (token.audible && last_received_decode_type_ == INAUDIBLE) { |
| + last_received_decode_type_ = BOTH; |
| + } else if (!token.audible && last_received_decode_type_ == AUDIBLE) { |
| + last_received_decode_type_ = BOTH; |
| + } else if (token.audible) { |
| + last_received_decode_type_ = AUDIBLE; |
| + } else { |
| + last_received_decode_type_ = INAUDIBLE; |
| + } |
| + } |
| } |
| base::MessageLoop message_loop_; |