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

Side by Side Diff: media/base/audio_renderer_mixer_unittest.cc

Issue 2023343002: Migrate WaitableEvent to enum-based constructor in media/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@WEvent_enums
Patch Set: Created 4 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // MSVC++ requires this to be set before any other includes to get M_PI. 5 // MSVC++ requires this to be set before any other includes to get M_PI.
6 #define _USE_MATH_DEFINES 6 #define _USE_MATH_DEFINES
7 7
8 #include "media/base/audio_renderer_mixer.h" 8 #include "media/base/audio_renderer_mixer.h"
9 9
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 } 469 }
470 470
471 // Ensure the physical stream is paused after a certain amount of time with no 471 // Ensure the physical stream is paused after a certain amount of time with no
472 // inputs playing. The test will hang if the behavior is incorrect. 472 // inputs playing. The test will hang if the behavior is incorrect.
473 TEST_P(AudioRendererMixerBehavioralTest, MixerPausesStream) { 473 TEST_P(AudioRendererMixerBehavioralTest, MixerPausesStream) {
474 const base::TimeDelta kPauseTime = base::TimeDelta::FromMilliseconds(500); 474 const base::TimeDelta kPauseTime = base::TimeDelta::FromMilliseconds(500);
475 // This value can't be too low or valgrind, tsan will timeout on the bots. 475 // This value can't be too low or valgrind, tsan will timeout on the bots.
476 const base::TimeDelta kTestTimeout = 10 * kPauseTime; 476 const base::TimeDelta kTestTimeout = 10 * kPauseTime;
477 mixer_->set_pause_delay_for_testing(kPauseTime); 477 mixer_->set_pause_delay_for_testing(kPauseTime);
478 478
479 base::WaitableEvent pause_event(true, false); 479 base::WaitableEvent pause_event(
480 base::WaitableEvent::ResetPolicy::MANUAL,
481 base::WaitableEvent::InitialState::NOT_SIGNALED);
480 EXPECT_CALL(*sink_.get(), Pause()).Times(2) 482 EXPECT_CALL(*sink_.get(), Pause()).Times(2)
481 .WillRepeatedly(SignalEvent(&pause_event)); 483 .WillRepeatedly(SignalEvent(&pause_event));
482 InitializeInputs(1); 484 InitializeInputs(1);
483 485
484 // Ensure never playing the input results in a sink pause. 486 // Ensure never playing the input results in a sink pause.
485 const base::TimeDelta kSleepTime = base::TimeDelta::FromMilliseconds(100); 487 const base::TimeDelta kSleepTime = base::TimeDelta::FromMilliseconds(100);
486 base::TimeTicks start_time = base::TimeTicks::Now(); 488 base::TimeTicks start_time = base::TimeTicks::Now();
487 while (!pause_event.IsSignaled()) { 489 while (!pause_event.IsSignaled()) {
488 mixer_callback_->Render(audio_bus_.get(), 0, 0); 490 mixer_callback_->Render(audio_bus_.get(), 0, 0);
489 base::PlatformThread::Sleep(kSleepTime); 491 base::PlatformThread::Sleep(kSleepTime);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 INSTANTIATE_TEST_CASE_P( 547 INSTANTIATE_TEST_CASE_P(
546 AudioRendererMixerBehavioralTest, 548 AudioRendererMixerBehavioralTest,
547 AudioRendererMixerBehavioralTest, 549 AudioRendererMixerBehavioralTest,
548 testing::ValuesIn(std::vector<AudioRendererMixerTestData>( 550 testing::ValuesIn(std::vector<AudioRendererMixerTestData>(
549 1, 551 1,
550 std::tr1::make_tuple(&kTestInputLower, 552 std::tr1::make_tuple(&kTestInputLower,
551 1, 553 1,
552 kTestInputLower, 554 kTestInputLower,
553 0.00000048)))); 555 0.00000048))));
554 } // namespace media 556 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/virtual_audio_output_stream_unittest.cc ('k') | media/base/bind_to_current_loop_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698