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

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

Issue 7587012: Remove mock_ffmpeg and update media unittests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable DecodeFrame_LargerXXX tests to make Valgrind happy. Created 9 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 | Annotate | Revision Log
« no previous file with comments | « media/base/test_data_util.h ('k') | media/base/video_decoder_config.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "media/base/test_data_util.h"
6
7 #include "base/file_util.h"
8 #include "base/logging.h"
9 #include "base/path_service.h"
10
11 namespace media {
12
13 void ReadTestDataFile(const std::string& name, scoped_array<uint8>* buffer,
14 int* size) {
15 FilePath file_path;
16 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &file_path));
17
18 file_path = file_path.Append(FILE_PATH_LITERAL("media"))
19 .Append(FILE_PATH_LITERAL("test"))
20 .Append(FILE_PATH_LITERAL("data"))
21 .AppendASCII(name);
22
23 int64 tmp = 0;
24 CHECK(file_util::GetFileSize(file_path, &tmp))
25 << "Failed to get file size for '" << name << "'";
26
27 int file_size = static_cast<int>(tmp);
28 buffer->reset(new uint8[file_size]);
29
30 CHECK(file_size == file_util::ReadFile(file_path,
31 reinterpret_cast<char*>(buffer->get()),
32 file_size))
33 << "Failed to read '" << name << "'";
34 *size = file_size;
35 }
36
37 void ReadTestDataFile(const std::string& name, scoped_refptr<Buffer>* buffer) {
38 scoped_array<uint8> buf;
39 int buf_size;
40 ReadTestDataFile(name, &buf, &buf_size);
41 *buffer = new DataBuffer(buf.release(), buf_size);
42 }
43
44 } // namespace media
OLDNEW
« no previous file with comments | « media/base/test_data_util.h ('k') | media/base/video_decoder_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698