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

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

Issue 2086353002: Remove calls to deprecated MessageLoop methods in media. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 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 | « media/base/demuxer_perftest.cc ('k') | media/base/pipeline_impl_unittest.cc » ('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 (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 #include "media/base/fake_demuxer_stream.h" 5 #include "media/base/fake_demuxer_stream.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/run_loop.h"
12 #include "media/base/decoder_buffer.h" 13 #include "media/base/decoder_buffer.h"
13 #include "media/base/demuxer_stream.h" 14 #include "media/base/demuxer_stream.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 16
16 namespace media { 17 namespace media {
17 18
18 const int kNumBuffersInOneConfig = 9; 19 const int kNumBuffersInOneConfig = 9;
19 const int kNumBuffersToReadFirst = 5; 20 const int kNumBuffersToReadFirst = 5;
20 const int kNumConfigs = 3; 21 const int kNumConfigs = 3;
21 static_assert(kNumBuffersToReadFirst < kNumBuffersInOneConfig, 22 static_assert(kNumBuffersToReadFirst < kNumBuffersInOneConfig,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 EXPECT_TRUE(read_pending_); 98 EXPECT_TRUE(read_pending_);
98 break; 99 break;
99 } 100 }
100 } 101 }
101 102
102 void ReadAndExpect(ReadResult result) { 103 void ReadAndExpect(ReadResult result) {
103 EXPECT_FALSE(read_pending_); 104 EXPECT_FALSE(read_pending_);
104 read_pending_ = true; 105 read_pending_ = true;
105 stream_->Read(base::Bind(&FakeDemuxerStreamTest::BufferReady, 106 stream_->Read(base::Bind(&FakeDemuxerStreamTest::BufferReady,
106 base::Unretained(this))); 107 base::Unretained(this)));
107 message_loop_.RunUntilIdle(); 108 base::RunLoop().RunUntilIdle();
108 ExpectReadResult(result); 109 ExpectReadResult(result);
109 } 110 }
110 111
111 void ReadUntilPending() { 112 void ReadUntilPending() {
112 while (1) { 113 while (1) {
113 read_pending_ = true; 114 read_pending_ = true;
114 stream_->Read(base::Bind(&FakeDemuxerStreamTest::BufferReady, 115 stream_->Read(base::Bind(&FakeDemuxerStreamTest::BufferReady,
115 base::Unretained(this))); 116 base::Unretained(this)));
116 message_loop_.RunUntilIdle(); 117 base::RunLoop().RunUntilIdle();
117 if (read_pending_) 118 if (read_pending_)
118 break; 119 break;
119 } 120 }
120 } 121 }
121 122
122 void SatisfyReadAndExpect(ReadResult result) { 123 void SatisfyReadAndExpect(ReadResult result) {
123 EXPECT_TRUE(read_pending_); 124 EXPECT_TRUE(read_pending_);
124 stream_->SatisfyRead(); 125 stream_->SatisfyRead();
125 message_loop_.RunUntilIdle(); 126 base::RunLoop().RunUntilIdle();
126 ExpectReadResult(result); 127 ExpectReadResult(result);
127 } 128 }
128 129
129 void Reset() { 130 void Reset() {
130 bool had_read_pending = read_pending_; 131 bool had_read_pending = read_pending_;
131 stream_->Reset(); 132 stream_->Reset();
132 message_loop_.RunUntilIdle(); 133 base::RunLoop().RunUntilIdle();
133 134
134 EXPECT_FALSE(read_pending_); 135 EXPECT_FALSE(read_pending_);
135 if (had_read_pending) 136 if (had_read_pending)
136 ExpectReadResult(ABORTED); 137 ExpectReadResult(ABORTED);
137 } 138 }
138 139
139 void ReadAllBuffers(int num_configs, int num_buffers_in_one_config) { 140 void ReadAllBuffers(int num_configs, int num_buffers_in_one_config) {
140 DCHECK_EQ(0, num_buffers_received_); 141 DCHECK_EQ(0, num_buffers_received_);
141 for (int i = 0; i < num_configs; ++i) { 142 for (int i = 0; i < num_configs; ++i) {
142 for (int j = 0; j < num_buffers_in_one_config; ++j) { 143 for (int j = 0; j < num_buffers_in_one_config; ++j) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 } 280 }
280 281
281 TEST_F(FakeDemuxerStreamTest, SeekToStart_AfterEOS) { 282 TEST_F(FakeDemuxerStreamTest, SeekToStart_AfterEOS) {
282 TestRead(3, 5, false); 283 TestRead(3, 5, false);
283 stream_->SeekToStart(); 284 stream_->SeekToStart();
284 num_buffers_received_ = 0; 285 num_buffers_received_ = 0;
285 ReadAllBuffers(3, 5); 286 ReadAllBuffers(3, 5);
286 } 287 }
287 288
288 } // namespace media 289 } // namespace media
OLDNEW
« no previous file with comments | « media/base/demuxer_perftest.cc ('k') | media/base/pipeline_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698