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

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

Issue 1233043003: Remove some legacy versions of StartsWith and EndsWith. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « ios/web/webui/web_ui_ios_data_source_impl.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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 std::vector<std::string> timestamps; 442 std::vector<std::string> timestamps;
443 base::SplitString(block_descriptions, ' ', &timestamps); 443 base::SplitString(block_descriptions, ' ', &timestamps);
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", true)) { 452 if (base::EndsWith(timestamp_str, "K", base::CompareCase::SENSITIVE)) {
453 block_info.flags = kWebMFlagKeyframe; 453 block_info.flags = kWebMFlagKeyframe;
454 // Remove the "K" off of the token. 454 // Remove the "K" off of the token.
455 timestamp_str = timestamp_str.substr(0, timestamps[i].length() - 1); 455 timestamp_str = timestamp_str.substr(0, timestamps[i].length() - 1);
456 } 456 }
457 CHECK(base::StringToInt(timestamp_str, &block_info.timestamp_in_ms)); 457 CHECK(base::StringToInt(timestamp_str, &block_info.timestamp_in_ms));
458 458
459 if (track_number == kTextTrackNum || 459 if (track_number == kTextTrackNum ||
460 track_number == kAlternateTextTrackNum) { 460 track_number == kAlternateTextTrackNum) {
461 block_info.duration = kTextBlockDuration; 461 block_info.duration = kTextBlockDuration;
462 ASSERT_EQ(kWebMFlagKeyframe, block_info.flags) 462 ASSERT_EQ(kWebMFlagKeyframe, block_info.flags)
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 break; 1075 break;
1076 1076
1077 if (i > 0) 1077 if (i > 0)
1078 ss << " "; 1078 ss << " ";
1079 ss << buffer->timestamp().InMilliseconds(); 1079 ss << buffer->timestamp().InMilliseconds();
1080 1080
1081 if (buffer->is_key_frame()) 1081 if (buffer->is_key_frame())
1082 ss << "K"; 1082 ss << "K";
1083 1083
1084 // Handle preroll buffers. 1084 // Handle preroll buffers.
1085 if (base::EndsWith(timestamps[i], "P", true)) { 1085 if (base::EndsWith(timestamps[i], "P", base::CompareCase::SENSITIVE)) {
1086 ASSERT_EQ(kInfiniteDuration(), buffer->discard_padding().first); 1086 ASSERT_EQ(kInfiniteDuration(), buffer->discard_padding().first);
1087 ASSERT_EQ(base::TimeDelta(), buffer->discard_padding().second); 1087 ASSERT_EQ(base::TimeDelta(), buffer->discard_padding().second);
1088 ss << "P"; 1088 ss << "P";
1089 } 1089 }
1090 } 1090 }
1091 EXPECT_EQ(expected, ss.str()); 1091 EXPECT_EQ(expected, ss.str());
1092 } 1092 }
1093 1093
1094 MOCK_METHOD1(Checkpoint, void(int id)); 1094 MOCK_METHOD1(Checkpoint, void(int id));
1095 1095
(...skipping 2652 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 | « ios/web/webui/web_ui_ios_data_source_impl.cc ('k') | media/filters/frame_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698