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

Side by Side Diff: media/audio/mac/audio_auhal_mac_unittest.cc

Issue 2056443002: Manual refactor to enum-based WaitableEvent for remaining mac/ios files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@d_1_explicit_bools
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 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/macros.h" 6 #include "base/macros.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/synchronization/waitable_event.h" 8 #include "base/synchronization/waitable_event.h"
9 #include "base/test/test_message_loop.h" 9 #include "base/test/test_message_loop.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 stream->Close(); 87 stream->Close();
88 } 88 }
89 89
90 TEST_F(AUHALStreamTest, CreateOpenStartStopClose) { 90 TEST_F(AUHALStreamTest, CreateOpenStartStopClose) {
91 ABORT_AUDIO_TEST_IF_NOT(OutputDevicesAvailable()); 91 ABORT_AUDIO_TEST_IF_NOT(OutputDevicesAvailable());
92 92
93 AudioOutputStream* stream = Create(); 93 AudioOutputStream* stream = Create();
94 EXPECT_TRUE(stream->Open()); 94 EXPECT_TRUE(stream->Open());
95 95
96 // Wait for the first two data callback from the OS. 96 // Wait for the first two data callback from the OS.
97 base::WaitableEvent event(false, false); 97 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC,
98 base::WaitableEvent::InitialState::NOT_SIGNALED);
98 int callback_counter = 0; 99 int callback_counter = 0;
99 const int number_of_callbacks = 2; 100 const int number_of_callbacks = 2;
100 EXPECT_CALL(source_, OnMoreData(_, _, _)) 101 EXPECT_CALL(source_, OnMoreData(_, _, _))
101 .Times(number_of_callbacks) 102 .Times(number_of_callbacks)
102 .WillRepeatedly(DoAll( 103 .WillRepeatedly(DoAll(
103 ZeroBuffer(), 104 ZeroBuffer(),
104 MaybeSignalEvent(&callback_counter, number_of_callbacks, &event), 105 MaybeSignalEvent(&callback_counter, number_of_callbacks, &event),
105 Return(0))); 106 Return(0)));
106 EXPECT_CALL(source_, OnError(_)).Times(0); 107 EXPECT_CALL(source_, OnError(_)).Times(0);
107 stream->Start(&source_); 108 stream->Start(&source_);
108 event.Wait(); 109 event.Wait();
109 110
110 stream->Stop(); 111 stream->Stop();
111 stream->Close(); 112 stream->Close();
112 113
113 EXPECT_FALSE(log_message_.empty()); 114 EXPECT_FALSE(log_message_.empty());
114 } 115 }
115 116
116 } // namespace media 117 } // namespace media
OLDNEW
« no previous file with comments | « ios/chrome/browser/browser_state/chrome_browser_state_impl.cc ('k') | ui/accelerated_widget_mac/window_resize_helper_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698