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

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

Issue 1875623002: Convert //chromecast from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « chromecast/media/base/media_message_loop.h ('k') | chromecast/media/cdm/browser_cdm_cast.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/location.h" 10 #include "base/location.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/run_loop.h" 11 #include "base/run_loop.h"
11 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
12 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
13 #include "base/task_runner.h" 14 #include "base/task_runner.h"
14 #include "base/threading/thread.h" 15 #include "base/threading/thread.h"
15 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 18
18 namespace chromecast { 19 namespace chromecast {
19 namespace media { 20 namespace media {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 FROM_HERE, base::Bind(&MediaResourceTracker::IncrementUsageCount, 93 FROM_HERE, base::Bind(&MediaResourceTracker::IncrementUsageCount,
93 base::Unretained(resource_tracker_))); 94 base::Unretained(resource_tracker_)));
94 } 95 }
95 void DecrementMediaUsageCount() { 96 void DecrementMediaUsageCount() {
96 media_task_runner_->PostTask( 97 media_task_runner_->PostTask(
97 FROM_HERE, base::Bind(&MediaResourceTracker::DecrementUsageCount, 98 FROM_HERE, base::Bind(&MediaResourceTracker::DecrementUsageCount,
98 base::Unretained(resource_tracker_))); 99 base::Unretained(resource_tracker_)));
99 } 100 }
100 101
101 MediaResourceTracker* resource_tracker_; 102 MediaResourceTracker* resource_tracker_;
102 scoped_ptr<MediaResourceTrackerTestMocks> test_mocks_; 103 std::unique_ptr<MediaResourceTrackerTestMocks> test_mocks_;
103 scoped_ptr<base::MessageLoop> message_loop_; 104 std::unique_ptr<base::MessageLoop> message_loop_;
104 scoped_ptr<base::Thread> media_thread_; 105 std::unique_ptr<base::Thread> media_thread_;
105 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; 106 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_;
106 107
107 DISALLOW_COPY_AND_ASSIGN(MediaResourceTrackerTest); 108 DISALLOW_COPY_AND_ASSIGN(MediaResourceTrackerTest);
108 }; 109 };
109 110
110 TEST_F(MediaResourceTrackerTest, BasicLifecycle) { 111 TEST_F(MediaResourceTrackerTest, BasicLifecycle) {
111 // Startup and shutdown flow: Initialize then FinalizeAndDestroy 112 // Startup and shutdown flow: Initialize then FinalizeAndDestroy
112 EXPECT_CALL(*test_mocks_, Initialize()).Times(1); 113 EXPECT_CALL(*test_mocks_, Initialize()).Times(1);
113 EXPECT_CALL(*test_mocks_, Finalize()).Times(1); 114 EXPECT_CALL(*test_mocks_, Finalize()).Times(1);
114 EXPECT_CALL(*test_mocks_, Destroyed()).Times(1); 115 EXPECT_CALL(*test_mocks_, Destroyed()).Times(1);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 EXPECT_CALL(*test_mocks_, OnStopUsingMedia()).Times(0); 249 EXPECT_CALL(*test_mocks_, OnStopUsingMedia()).Times(0);
249 250
250 DecrementMediaUsageCount(); 251 DecrementMediaUsageCount();
251 252
252 RunUntilIdle(media_task_runner_.get()); 253 RunUntilIdle(media_task_runner_.get());
253 base::RunLoop().RunUntilIdle(); 254 base::RunLoop().RunUntilIdle();
254 } 255 }
255 256
256 } // namespace media 257 } // namespace media
257 } // namespace chromecast 258 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/media/base/media_message_loop.h ('k') | chromecast/media/cdm/browser_cdm_cast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698