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

Side by Side Diff: media/test/pipeline_integration_test.cc

Issue 2104363004: Remove remaining calls to deprecated MessageLoop methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix build 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
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/run_loop.h"
17 #include "base/single_thread_task_runner.h" 18 #include "base/single_thread_task_runner.h"
18 #include "base/strings/string_split.h" 19 #include "base/strings/string_split.h"
19 #include "base/strings/string_util.h" 20 #include "base/strings/string_util.h"
20 #include "base/threading/thread_task_runner_handle.h" 21 #include "base/threading/thread_task_runner_handle.h"
21 #include "build/build_config.h" 22 #include "build/build_config.h"
22 #include "media/base/cdm_callback_promise.h" 23 #include "media/base/cdm_callback_promise.h"
23 #include "media/base/cdm_context.h" 24 #include "media/base/cdm_context.h"
24 #include "media/base/cdm_key_information.h" 25 #include "media/base/cdm_key_information.h"
25 #include "media/base/decoder_buffer.h" 26 #include "media/base/decoder_buffer.h"
26 #include "media/base/media.h" 27 #include "media/base/media.h"
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 783
783 pipeline_->Start(demuxer_.get(), CreateRenderer(), this, 784 pipeline_->Start(demuxer_.get(), CreateRenderer(), this,
784 base::Bind(&PipelineIntegrationTest::OnStatusCallback, 785 base::Bind(&PipelineIntegrationTest::OnStatusCallback,
785 base::Unretained(this))); 786 base::Unretained(this)));
786 787
787 if (encrypted_media) { 788 if (encrypted_media) {
788 source->set_encrypted_media_init_data_cb( 789 source->set_encrypted_media_init_data_cb(
789 base::Bind(&FakeEncryptedMedia::OnEncryptedMediaInitData, 790 base::Bind(&FakeEncryptedMedia::OnEncryptedMediaInitData,
790 base::Unretained(encrypted_media))); 791 base::Unretained(encrypted_media)));
791 } 792 }
792 message_loop_.Run(); 793 base::RunLoop().Run();
gab 2016/06/30 20:28:18 Feels a bit weird to replace a member call by a st
fdoray 2016/07/04 13:59:46 MessageLoop::Run() and MessageLoop::RunUntilIdle()
gab 2016/07/04 14:47:06 Hmm I don't think there's precedent for such a pre
fdoray 2016/07/04 16:33:59 Will document the desired paradigm in a separate C
793 return pipeline_status_; 794 return pipeline_status_;
794 } 795 }
795 796
796 // Verifies that seeking works properly for ChunkDemuxer when the 797 // Verifies that seeking works properly for ChunkDemuxer when the
797 // seek happens while there is a pending read on the ChunkDemuxer 798 // seek happens while there is a pending read on the ChunkDemuxer
798 // and no data is available. 799 // and no data is available.
799 bool TestSeekDuringRead(const std::string& filename, 800 bool TestSeekDuringRead(const std::string& filename,
800 const std::string& mimetype, 801 const std::string& mimetype,
801 int initial_append_size, 802 int initial_append_size,
802 base::TimeDelta start_seek_time, 803 base::TimeDelta start_seek_time,
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 MockMediaSource source(input_filename, kWebM, kAppendWholeFile); 1244 MockMediaSource source(input_filename, kWebM, kAppendWholeFile);
1244 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); 1245 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
1245 1246
1246 auto buffered_ranges = pipeline_->GetBufferedTimeRanges(); 1247 auto buffered_ranges = pipeline_->GetBufferedTimeRanges();
1247 EXPECT_EQ(1u, buffered_ranges.size()); 1248 EXPECT_EQ(1u, buffered_ranges.size());
1248 EXPECT_EQ(0, buffered_ranges.start(0).InMilliseconds()); 1249 EXPECT_EQ(0, buffered_ranges.start(0).InMilliseconds());
1249 EXPECT_EQ(k320WebMFileDurationMs, buffered_ranges.end(0).InMilliseconds()); 1250 EXPECT_EQ(k320WebMFileDurationMs, buffered_ranges.end(0).InMilliseconds());
1250 1251
1251 source.RemoveRange(base::TimeDelta::FromMilliseconds(1000), 1252 source.RemoveRange(base::TimeDelta::FromMilliseconds(1000),
1252 base::TimeDelta::FromMilliseconds(k320WebMFileDurationMs)); 1253 base::TimeDelta::FromMilliseconds(k320WebMFileDurationMs));
1253 message_loop_.RunUntilIdle(); 1254 base::RunLoop().RunUntilIdle();
1254 1255
1255 buffered_ranges = pipeline_->GetBufferedTimeRanges(); 1256 buffered_ranges = pipeline_->GetBufferedTimeRanges();
1256 EXPECT_EQ(1u, buffered_ranges.size()); 1257 EXPECT_EQ(1u, buffered_ranges.size());
1257 EXPECT_EQ(0, buffered_ranges.start(0).InMilliseconds()); 1258 EXPECT_EQ(0, buffered_ranges.start(0).InMilliseconds());
1258 EXPECT_EQ(1001, buffered_ranges.end(0).InMilliseconds()); 1259 EXPECT_EQ(1001, buffered_ranges.end(0).InMilliseconds());
1259 1260
1260 source.Shutdown(); 1261 source.Shutdown();
1261 Stop(); 1262 Stop();
1262 } 1263 }
1263 1264
(...skipping 15 matching lines...) Expand all
1279 EXPECT_EQ(1u, buffered_ranges.size()); 1280 EXPECT_EQ(1u, buffered_ranges.size());
1280 do { 1281 do {
1281 // Advance media_time to the end of the currently buffered data 1282 // Advance media_time to the end of the currently buffered data
1282 base::TimeDelta media_time = buffered_ranges.end(0); 1283 base::TimeDelta media_time = buffered_ranges.end(0);
1283 source.Seek(media_time); 1284 source.Seek(media_time);
1284 // Ask MediaSource to evict buffered data if buffering limit has been 1285 // Ask MediaSource to evict buffered data if buffering limit has been
1285 // reached (the data will be evicted from the front of the buffered range). 1286 // reached (the data will be evicted from the front of the buffered range).
1286 source.EvictCodedFrames(media_time, file->data_size()); 1287 source.EvictCodedFrames(media_time, file->data_size());
1287 ASSERT_TRUE( 1288 ASSERT_TRUE(
1288 source.AppendAtTime(media_time, file->data(), file->data_size())); 1289 source.AppendAtTime(media_time, file->data(), file->data_size()));
1289 message_loop_.RunUntilIdle(); 1290 base::RunLoop().RunUntilIdle();
1290 1291
1291 buffered_ranges = pipeline_->GetBufferedTimeRanges(); 1292 buffered_ranges = pipeline_->GetBufferedTimeRanges();
1292 } while (buffered_ranges.size() == 1 && 1293 } while (buffered_ranges.size() == 1 &&
1293 buffered_ranges.start(0) == base::TimeDelta::FromSeconds(0)); 1294 buffered_ranges.start(0) == base::TimeDelta::FromSeconds(0));
1294 1295
1295 EXPECT_EQ(1u, buffered_ranges.size()); 1296 EXPECT_EQ(1u, buffered_ranges.size());
1296 source.Shutdown(); 1297 source.Shutdown();
1297 Stop(); 1298 Stop();
1298 } 1299 }
1299 1300
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 1337
1337 scoped_refptr<DecoderBuffer> second_file = 1338 scoped_refptr<DecoderBuffer> second_file =
1338 ReadTestDataFile("bear-640x360-av_enc-av.webm"); 1339 ReadTestDataFile("bear-640x360-av_enc-av.webm");
1339 1340
1340 ASSERT_FALSE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), 1341 ASSERT_FALSE(source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1341 second_file->data(), 1342 second_file->data(),
1342 second_file->data_size())); 1343 second_file->data_size()));
1343 1344
1344 source.EndOfStream(); 1345 source.EndOfStream();
1345 1346
1346 message_loop_.Run(); 1347 base::RunLoop().Run();
1347 EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, pipeline_status_); 1348 EXPECT_EQ(CHUNK_DEMUXER_ERROR_APPEND_FAILED, pipeline_status_);
1348 1349
1349 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1350 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1350 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1351 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1351 // The second video was not added, so its time has not been added. 1352 // The second video was not added, so its time has not been added.
1352 EXPECT_EQ(k320WebMFileDurationMs, 1353 EXPECT_EQ(k320WebMFileDurationMs,
1353 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1354 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1354 1355
1355 Play(); 1356 Play();
1356 1357
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after
2321 2322
2322 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { 2323 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) {
2323 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); 2324 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm"));
2324 Play(); 2325 Play();
2325 ASSERT_TRUE(WaitUntilOnEnded()); 2326 ASSERT_TRUE(WaitUntilOnEnded());
2326 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), 2327 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000),
2327 demuxer_->GetStartTime()); 2328 demuxer_->GetStartTime());
2328 } 2329 }
2329 2330
2330 } // namespace media 2331 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698