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

Side by Side Diff: media/filters/chunk_demuxer_unittest.cc

Issue 1272823003: Update SplitString calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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/mime_util_unittest.cc ('k') | media/filters/frame_processor_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 <algorithm> 5 #include <algorithm>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 // |track_number| - The track number to place in 432 // |track_number| - The track number to place in
433 // |block_descriptions| - A space delimited string of block info that 433 // |block_descriptions| - A space delimited string of block info that
434 // is used to populate |blocks|. Each block info has a timestamp in 434 // is used to populate |blocks|. Each block info has a timestamp in
435 // milliseconds and optionally followed by a 'K' to indicate that a block 435 // milliseconds and optionally followed by a 'K' to indicate that a block
436 // should be marked as a key frame. For example "0K 30 60" should populate 436 // should be marked as a key frame. For example "0K 30 60" should populate
437 // |blocks| with 3 BlockInfo objects: a key frame with timestamp 0 and 2 437 // |blocks| with 3 BlockInfo objects: a key frame with timestamp 0 and 2
438 // non-key-frames at 30ms and 60ms. 438 // non-key-frames at 30ms and 60ms.
439 void ParseBlockDescriptions(int track_number, 439 void ParseBlockDescriptions(int track_number,
440 const std::string block_descriptions, 440 const std::string block_descriptions,
441 std::vector<BlockInfo>* blocks) { 441 std::vector<BlockInfo>* blocks) {
442 std::vector<std::string> timestamps; 442 std::vector<std::string> timestamps = base::SplitString(
443 base::SplitString(block_descriptions, ' ', &timestamps); 443 block_descriptions, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
444 444
445 for (size_t i = 0; i < timestamps.size(); ++i) { 445 for (size_t i = 0; i < timestamps.size(); ++i) {
446 std::string timestamp_str = timestamps[i]; 446 std::string timestamp_str = timestamps[i];
447 BlockInfo block_info; 447 BlockInfo block_info;
448 block_info.track_number = track_number; 448 block_info.track_number = track_number;
449 block_info.flags = 0; 449 block_info.flags = 0;
450 block_info.duration = 0; 450 block_info.duration = 0;
451 451
452 if (base::EndsWith(timestamp_str, "K", base::CompareCase::SENSITIVE)) { 452 if (base::EndsWith(timestamp_str, "K", base::CompareCase::SENSITIVE)) {
453 block_info.flags = kWebMFlagKeyframe; 453 block_info.flags = kWebMFlagKeyframe;
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 1052
1053 void ExpectConfigChanged(DemuxerStream::Type type) { 1053 void ExpectConfigChanged(DemuxerStream::Type type) {
1054 EXPECT_CALL(*this, ReadDone(DemuxerStream::kConfigChanged, _)); 1054 EXPECT_CALL(*this, ReadDone(DemuxerStream::kConfigChanged, _));
1055 demuxer_->GetStream(type)->Read(base::Bind( 1055 demuxer_->GetStream(type)->Read(base::Bind(
1056 &ChunkDemuxerTest::ReadDone, base::Unretained(this))); 1056 &ChunkDemuxerTest::ReadDone, base::Unretained(this)));
1057 message_loop_.RunUntilIdle(); 1057 message_loop_.RunUntilIdle();
1058 } 1058 }
1059 1059
1060 void CheckExpectedBuffers(DemuxerStream* stream, 1060 void CheckExpectedBuffers(DemuxerStream* stream,
1061 const std::string& expected) { 1061 const std::string& expected) {
1062 std::vector<std::string> timestamps; 1062 std::vector<std::string> timestamps = base::SplitString(
1063 base::SplitString(expected, ' ', &timestamps); 1063 expected, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
1064 std::stringstream ss; 1064 std::stringstream ss;
1065 for (size_t i = 0; i < timestamps.size(); ++i) { 1065 for (size_t i = 0; i < timestamps.size(); ++i) {
1066 // Initialize status to kAborted since it's possible for Read() to return 1066 // Initialize status to kAborted since it's possible for Read() to return
1067 // without calling StoreStatusAndBuffer() if it doesn't have any buffers 1067 // without calling StoreStatusAndBuffer() if it doesn't have any buffers
1068 // left to return. 1068 // left to return.
1069 DemuxerStream::Status status = DemuxerStream::kAborted; 1069 DemuxerStream::Status status = DemuxerStream::kAborted;
1070 scoped_refptr<DecoderBuffer> buffer; 1070 scoped_refptr<DecoderBuffer> buffer;
1071 stream->Read(base::Bind(&ChunkDemuxerTest::StoreStatusAndBuffer, 1071 stream->Read(base::Bind(&ChunkDemuxerTest::StoreStatusAndBuffer,
1072 base::Unretained(this), &status, &buffer)); 1072 base::Unretained(this), &status, &buffer));
1073 base::MessageLoop::current()->RunUntilIdle(); 1073 base::MessageLoop::current()->RunUntilIdle();
(...skipping 2674 matching lines...) Expand 10 before | Expand all | Expand 10 after
3748 TEST_F(ChunkDemuxerTest, CuesBetweenClusters) { 3748 TEST_F(ChunkDemuxerTest, CuesBetweenClusters) {
3749 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO)); 3749 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO));
3750 3750
3751 AppendCluster(GenerateCluster(0, 0, 4)); 3751 AppendCluster(GenerateCluster(0, 0, 4));
3752 AppendData(kCuesHeader, sizeof(kCuesHeader)); 3752 AppendData(kCuesHeader, sizeof(kCuesHeader));
3753 AppendCluster(GenerateCluster(46, 66, 5)); 3753 AppendCluster(GenerateCluster(46, 66, 5));
3754 CheckExpectedRanges(kSourceId, "{ [0,115) }"); 3754 CheckExpectedRanges(kSourceId, "{ [0,115) }");
3755 } 3755 }
3756 3756
3757 } // namespace media 3757 } // namespace media
OLDNEW
« no previous file with comments | « media/base/mime_util_unittest.cc ('k') | media/filters/frame_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698