| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 252 |
| 253 wasp_impl_->Initialize(params_, &fake_callback_); | 253 wasp_impl_->Initialize(params_, &fake_callback_); |
| 254 SetClient(this); | 254 SetClient(this); |
| 255 | 255 |
| 256 // Verify provideInput() is muted prior to Start() and no calls to the render | 256 // Verify provideInput() is muted prior to Start() and no calls to the render |
| 257 // callback have occurred. | 257 // callback have occurred. |
| 258 bus1->channel(0)[0] = 1; | 258 bus1->channel(0)[0] = 1; |
| 259 bus2->Zero(); | 259 bus2->Zero(); |
| 260 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer()); | 260 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer()); |
| 261 ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get())); | 261 ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get())); |
| 262 ASSERT_EQ(fake_callback_.last_frames_delayed(), -1); | 262 ASSERT_EQ(fake_callback_.last_delay(), base::TimeDelta::Max()); |
| 263 | 263 |
| 264 wasp_impl_->Start(); | 264 wasp_impl_->Start(); |
| 265 | 265 |
| 266 // Ditto for Play(). | 266 // Ditto for Play(). |
| 267 bus1->channel(0)[0] = 1; | 267 bus1->channel(0)[0] = 1; |
| 268 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer()); | 268 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer()); |
| 269 ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get())); | 269 ASSERT_TRUE(CompareBusses(bus1.get(), bus2.get())); |
| 270 ASSERT_EQ(fake_callback_.last_frames_delayed(), -1); | 270 ASSERT_EQ(fake_callback_.last_delay(), base::TimeDelta::Max()); |
| 271 | 271 |
| 272 wasp_impl_->Play(); | 272 wasp_impl_->Play(); |
| 273 | 273 |
| 274 // Now we should get real audio data. | 274 // Now we should get real audio data. |
| 275 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer()); | 275 wasp_impl_->provideInput(audio_data, params_.frames_per_buffer()); |
| 276 ASSERT_FALSE(CompareBusses(bus1.get(), bus2.get())); | 276 ASSERT_FALSE(CompareBusses(bus1.get(), bus2.get())); |
| 277 | 277 |
| 278 // Ensure volume adjustment is working. | 278 // Ensure volume adjustment is working. |
| 279 fake_callback_.reset(); | 279 fake_callback_.reset(); |
| 280 fake_callback_.Render(base::TimeDelta(), base::TimeTicks::Now(), 0, | 280 fake_callback_.Render(base::TimeDelta(), base::TimeTicks::Now(), 0, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 } | 341 } |
| 342 | 342 |
| 343 INSTANTIATE_TEST_CASE_P( | 343 INSTANTIATE_TEST_CASE_P( |
| 344 /* prefix intentionally left blank due to only one parameterization */, | 344 /* prefix intentionally left blank due to only one parameterization */, |
| 345 WebAudioSourceProviderImplTest, | 345 WebAudioSourceProviderImplTest, |
| 346 testing::Values(WaspSinkStatus::WASP_SINK_OK, | 346 testing::Values(WaspSinkStatus::WASP_SINK_OK, |
| 347 WaspSinkStatus::WASP_SINK_ERROR, | 347 WaspSinkStatus::WASP_SINK_ERROR, |
| 348 WaspSinkStatus::WASP_SINK_NULL)); | 348 WaspSinkStatus::WASP_SINK_NULL)); |
| 349 | 349 |
| 350 } // namespace media | 350 } // namespace media |
| OLD | NEW |