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

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

Issue 12217101: Replace FilePath with base::FilePath in some more top level directories. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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/media_win.cc ('k') | media/base/yuv_convert_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 "media/base/test_data_util.h" 5 #include "media/base/test_data_util.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "media/base/decoder_buffer.h" 10 #include "media/base/decoder_buffer.h"
11 11
12 namespace media { 12 namespace media {
13 13
14 FilePath GetTestDataFilePath(const std::string& name) { 14 FilePath GetTestDataFilePath(const std::string& name) {
15 FilePath file_path; 15 base::FilePath file_path;
16 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &file_path)); 16 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &file_path));
17 17
18 file_path = file_path.Append(FILE_PATH_LITERAL("media")) 18 file_path = file_path.Append(FILE_PATH_LITERAL("media"))
19 .Append(FILE_PATH_LITERAL("test")) 19 .Append(FILE_PATH_LITERAL("test"))
20 .Append(FILE_PATH_LITERAL("data")) 20 .Append(FILE_PATH_LITERAL("data"))
21 .AppendASCII(name); 21 .AppendASCII(name);
22 return file_path; 22 return file_path;
23 } 23 }
24 24
25 scoped_refptr<DecoderBuffer> ReadTestDataFile(const std::string& name) { 25 scoped_refptr<DecoderBuffer> ReadTestDataFile(const std::string& name) {
26 FilePath file_path; 26 base::FilePath file_path;
27 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &file_path)); 27 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &file_path));
28 28
29 file_path = file_path.Append(FILE_PATH_LITERAL("media")) 29 file_path = file_path.Append(FILE_PATH_LITERAL("media"))
30 .Append(FILE_PATH_LITERAL("test")) 30 .Append(FILE_PATH_LITERAL("test"))
31 .Append(FILE_PATH_LITERAL("data")) 31 .Append(FILE_PATH_LITERAL("data"))
32 .AppendASCII(name); 32 .AppendASCII(name);
33 33
34 int64 tmp = 0; 34 int64 tmp = 0;
35 CHECK(file_util::GetFileSize(file_path, &tmp)) 35 CHECK(file_util::GetFileSize(file_path, &tmp))
36 << "Failed to get file size for '" << name << "'"; 36 << "Failed to get file size for '" << name << "'";
37 37
38 int file_size = static_cast<int>(tmp); 38 int file_size = static_cast<int>(tmp);
39 39
40 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(file_size)); 40 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(file_size));
41 CHECK_EQ(file_size, file_util::ReadFile( 41 CHECK_EQ(file_size, file_util::ReadFile(
42 file_path, reinterpret_cast<char*>(buffer->GetWritableData()), file_size)) 42 file_path, reinterpret_cast<char*>(buffer->GetWritableData()), file_size))
43 << "Failed to read '" << name << "'"; 43 << "Failed to read '" << name << "'";
44 44
45 return buffer; 45 return buffer;
46 } 46 }
47 47
48 } // namespace media 48 } // namespace media
OLDNEW
« no previous file with comments | « media/base/media_win.cc ('k') | media/base/yuv_convert_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698