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

Side by Side Diff: media/formats/common/stream_parser_test_base.cc

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/formats/common/stream_parser_test_base.h" 5 #include "media/formats/common/stream_parser_test_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "media/base/test_data_util.h" 8 #include "media/base/test_data_util.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 std::string StreamParserTestBase::ParseFile(const std::string& filename, 46 std::string StreamParserTestBase::ParseFile(const std::string& filename,
47 int append_bytes) { 47 int append_bytes) {
48 results_stream_.clear(); 48 results_stream_.clear();
49 scoped_refptr<DecoderBuffer> buffer = ReadTestDataFile(filename); 49 scoped_refptr<DecoderBuffer> buffer = ReadTestDataFile(filename);
50 EXPECT_TRUE( 50 EXPECT_TRUE(
51 AppendDataInPieces(buffer->data(), buffer->data_size(), append_bytes)); 51 AppendDataInPieces(buffer->data(), buffer->data_size(), append_bytes));
52 return results_stream_.str(); 52 return results_stream_.str();
53 } 53 }
54 54
55 std::string StreamParserTestBase::ParseData(const uint8* data, size_t length) { 55 std::string StreamParserTestBase::ParseData(const uint8_t* data,
56 size_t length) {
56 results_stream_.clear(); 57 results_stream_.clear();
57 EXPECT_TRUE(AppendDataInPieces(data, length, length)); 58 EXPECT_TRUE(AppendDataInPieces(data, length, length));
58 return results_stream_.str(); 59 return results_stream_.str();
59 } 60 }
60 61
61 bool StreamParserTestBase::AppendDataInPieces(const uint8* data, 62 bool StreamParserTestBase::AppendDataInPieces(const uint8_t* data,
62 size_t length, 63 size_t length,
63 size_t piece_size) { 64 size_t piece_size) {
64 const uint8* start = data; 65 const uint8_t* start = data;
65 const uint8* end = data + length; 66 const uint8_t* end = data + length;
66 while (start < end) { 67 while (start < end) {
67 size_t append_size = std::min(piece_size, static_cast<size_t>(end - start)); 68 size_t append_size = std::min(piece_size, static_cast<size_t>(end - start));
68 if (!parser_->Parse(start, append_size)) 69 if (!parser_->Parse(start, append_size))
69 return false; 70 return false;
70 start += append_size; 71 start += append_size;
71 } 72 }
72 return true; 73 return true;
73 } 74 }
74 75
75 void StreamParserTestBase::OnInitDone( 76 void StreamParserTestBase::OnInitDone(
(...skipping 26 matching lines...) Expand all
102 // http://crbug.com/336926. 103 // http://crbug.com/336926.
103 EXPECT_TRUE(text_map.empty()); 104 EXPECT_TRUE(text_map.empty());
104 105
105 const std::string buffers_str = BufferQueueToString(audio_buffers); 106 const std::string buffers_str = BufferQueueToString(audio_buffers);
106 DVLOG(1) << __FUNCTION__ << " : " << buffers_str; 107 DVLOG(1) << __FUNCTION__ << " : " << buffers_str;
107 results_stream_ << buffers_str; 108 results_stream_ << buffers_str;
108 return true; 109 return true;
109 } 110 }
110 111
111 void StreamParserTestBase::OnKeyNeeded(EmeInitDataType type, 112 void StreamParserTestBase::OnKeyNeeded(EmeInitDataType type,
112 const std::vector<uint8>& init_data) { 113 const std::vector<uint8_t>& init_data) {
113 DVLOG(1) << __FUNCTION__ << "(" << static_cast<int>(type) << ", " 114 DVLOG(1) << __FUNCTION__ << "(" << static_cast<int>(type) << ", "
114 << init_data.size() << ")"; 115 << init_data.size() << ")";
115 } 116 }
116 117
117 void StreamParserTestBase::OnNewSegment() { 118 void StreamParserTestBase::OnNewSegment() {
118 DVLOG(1) << __FUNCTION__; 119 DVLOG(1) << __FUNCTION__;
119 results_stream_ << "NewSegment"; 120 results_stream_ << "NewSegment";
120 } 121 }
121 122
122 void StreamParserTestBase::OnEndOfSegment() { 123 void StreamParserTestBase::OnEndOfSegment() {
123 DVLOG(1) << __FUNCTION__; 124 DVLOG(1) << __FUNCTION__;
124 results_stream_ << "EndOfSegment"; 125 results_stream_ << "EndOfSegment";
125 } 126 }
126 127
127 } // namespace media 128 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698