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

Side by Side Diff: chromecast/media/base/media_resource_tracker_unittest.cc

Issue 2043303004: More WaitableEvent stragglers migrated to enum-based constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@d_4_misc
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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chromecast/media/base/media_resource_tracker.h" 5 #include "chromecast/media/base/media_resource_tracker.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
14 #include "base/task_runner.h" 14 #include "base/task_runner.h"
15 #include "base/threading/thread.h" 15 #include "base/threading/thread.h"
16 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 namespace chromecast { 19 namespace chromecast {
20 namespace media { 20 namespace media {
21 21
22 void RunUntilIdle(base::TaskRunner* task_runner) { 22 void RunUntilIdle(base::TaskRunner* task_runner) {
23 base::WaitableEvent completion_event(false, false); 23 base::WaitableEvent completion_event(
24 base::WaitableEvent::ResetPolicy::AUTOMATIC,
25 base::WaitableEvent::InitialState::NOT_SIGNALED);
24 task_runner->PostTask(FROM_HERE, 26 task_runner->PostTask(FROM_HERE,
25 base::Bind(&base::WaitableEvent::Signal, 27 base::Bind(&base::WaitableEvent::Signal,
26 base::Unretained(&completion_event))); 28 base::Unretained(&completion_event)));
27 completion_event.Wait(); 29 completion_event.Wait();
28 } 30 }
29 31
30 // Collection of mocks to verify MediaResourceTracker takes the correct actions. 32 // Collection of mocks to verify MediaResourceTracker takes the correct actions.
31 class MediaResourceTrackerTestMocks : public MediaResourceTracker::Delegate { 33 class MediaResourceTrackerTestMocks : public MediaResourceTracker::Delegate {
32 public: 34 public:
33 MOCK_METHOD0(Initialize, void()); // CastMediaShlib::Initialize 35 MOCK_METHOD0(Initialize, void()); // CastMediaShlib::Initialize
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 EXPECT_CALL(*test_mocks_, OnStopUsingMedia()).Times(0); 251 EXPECT_CALL(*test_mocks_, OnStopUsingMedia()).Times(0);
250 252
251 DecrementMediaUsageCount(); 253 DecrementMediaUsageCount();
252 254
253 RunUntilIdle(media_task_runner_.get()); 255 RunUntilIdle(media_task_runner_.get());
254 base::RunLoop().RunUntilIdle(); 256 base::RunLoop().RunUntilIdle();
255 } 257 }
256 258
257 } // namespace media 259 } // namespace media
258 } // namespace chromecast 260 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/base/bind_to_task_runner_unittest.cc ('k') | chromecast/media/cma/ipc/media_message_fifo_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698