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

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

Issue 17408005: Refactored DecoderBuffer to use unix_hacker_style naming. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@localrefactor
Patch Set: Created 7 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/test_data_util.cc ('k') | media/crypto/aes_decryptor.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/test_helpers.h" 5 #include "media/base/test_helpers.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/pickle.h" 10 #include "base/pickle.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 base::TimeDelta timestamp, base::TimeDelta duration) { 251 base::TimeDelta timestamp, base::TimeDelta duration) {
252 Pickle pickle; 252 Pickle pickle;
253 pickle.WriteString(kFakeVideoBufferHeader); 253 pickle.WriteString(kFakeVideoBufferHeader);
254 pickle.WriteInt(config.coded_size().width()); 254 pickle.WriteInt(config.coded_size().width());
255 pickle.WriteInt(config.coded_size().height()); 255 pickle.WriteInt(config.coded_size().height());
256 pickle.WriteInt64(timestamp.InMilliseconds()); 256 pickle.WriteInt64(timestamp.InMilliseconds());
257 257
258 scoped_refptr<DecoderBuffer> buffer = DecoderBuffer::CopyFrom( 258 scoped_refptr<DecoderBuffer> buffer = DecoderBuffer::CopyFrom(
259 static_cast<const uint8*>(pickle.data()), 259 static_cast<const uint8*>(pickle.data()),
260 static_cast<int>(pickle.size())); 260 static_cast<int>(pickle.size()));
261 buffer->SetTimestamp(timestamp); 261 buffer->set_timestamp(timestamp);
262 buffer->SetDuration(duration); 262 buffer->set_duration(duration);
263 263
264 return buffer; 264 return buffer;
265 } 265 }
266 266
267 bool VerifyFakeVideoBufferForTest( 267 bool VerifyFakeVideoBufferForTest(
268 const scoped_refptr<DecoderBuffer>& buffer, 268 const scoped_refptr<DecoderBuffer>& buffer,
269 const VideoDecoderConfig& config) { 269 const VideoDecoderConfig& config) {
270 // Check if the input |buffer| matches the |config|. 270 // Check if the input |buffer| matches the |config|.
271 PickleIterator pickle(Pickle(reinterpret_cast<const char*>(buffer->GetData()), 271 PickleIterator pickle(Pickle(reinterpret_cast<const char*>(buffer->data()),
272 buffer->GetDataSize())); 272 buffer->data_size()));
273 std::string header; 273 std::string header;
274 int width = 0; 274 int width = 0;
275 int height = 0; 275 int height = 0;
276 bool success = pickle.ReadString(&header) && pickle.ReadInt(&width) && 276 bool success = pickle.ReadString(&header) && pickle.ReadInt(&width) &&
277 pickle.ReadInt(&height); 277 pickle.ReadInt(&height);
278 return (success && header == kFakeVideoBufferHeader && 278 return (success && header == kFakeVideoBufferHeader &&
279 width == config.coded_size().width() && 279 width == config.coded_size().width() &&
280 height == config.coded_size().height()); 280 height == config.coded_size().height());
281 } 281 }
282 282
283 } // namespace media 283 } // namespace media
OLDNEW
« no previous file with comments | « media/base/test_data_util.cc ('k') | media/crypto/aes_decryptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698