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

Side by Side Diff: chrome/common/media_galleries/pmp_test_util.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/common/media_galleries/pmp_test_util.h" 5 #include "chrome/common/media_galleries/pmp_test_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } 54 }
55 55
56 } // namespace 56 } // namespace
57 57
58 bool PmpTestUtil::WriteIndicatorFile( 58 bool PmpTestUtil::WriteIndicatorFile(
59 const base::FilePath& column_file_destination, 59 const base::FilePath& column_file_destination,
60 const std::string& table_name) { 60 const std::string& table_name) {
61 base::FilePath indicator_path = column_file_destination.Append( 61 base::FilePath indicator_path = column_file_destination.Append(
62 base::FilePath::FromUTF8Unsafe(table_name + "_0")); 62 base::FilePath::FromUTF8Unsafe(table_name + "_0"));
63 63
64 return file_util::WriteFile(indicator_path, NULL, 0) == 0; 64 return base::WriteFile(indicator_path, NULL, 0) == 0;
65 } 65 }
66 66
67 template<class T> 67 template<class T>
68 bool PmpTestUtil::WriteColumnFileFromVector( 68 bool PmpTestUtil::WriteColumnFileFromVector(
69 const base::FilePath& column_file_destination, 69 const base::FilePath& column_file_destination,
70 const std::string& table_name, 70 const std::string& table_name,
71 const std::string& column_name, 71 const std::string& column_name,
72 const PmpFieldType field_type, 72 const PmpFieldType field_type,
73 const std::vector<T>& elements_vector) { 73 const std::vector<T>& elements_vector) {
74 std::string file_name = table_name + "_" + column_name + "." + kPmpExtension; 74 std::string file_name = table_name + "_" + column_name + "." + kPmpExtension;
75 75
76 base::FilePath path = column_file_destination.AppendASCII(file_name); 76 base::FilePath path = column_file_destination.AppendASCII(file_name);
77 77
78 std::vector<char> data = PmpTestUtil::MakeHeaderAndBody( 78 std::vector<char> data = PmpTestUtil::MakeHeaderAndBody(
79 field_type, elements_vector.size(), elements_vector); 79 field_type, elements_vector.size(), elements_vector);
80 80
81 size_t bytes_written = file_util::WriteFile(path, &data[0], data.size()); 81 size_t bytes_written = base::WriteFile(path, &data[0], data.size());
82 return (bytes_written == data.size()); 82 return (bytes_written == data.size());
83 } 83 }
84 84
85 // Explicit Instantiation for all the valid types. 85 // Explicit Instantiation for all the valid types.
86 template bool PmpTestUtil::WriteColumnFileFromVector<std::string>( 86 template bool PmpTestUtil::WriteColumnFileFromVector<std::string>(
87 const base::FilePath&, const std::string&, const std::string&, 87 const base::FilePath&, const std::string&, const std::string&,
88 const PmpFieldType, const std::vector<std::string>&); 88 const PmpFieldType, const std::vector<std::string>&);
89 template bool PmpTestUtil::WriteColumnFileFromVector<uint32>( 89 template bool PmpTestUtil::WriteColumnFileFromVector<uint32>(
90 const base::FilePath&, const std::string&, const std::string&, 90 const base::FilePath&, const std::string&, const std::string&,
91 const PmpFieldType, const std::vector<uint32>&); 91 const PmpFieldType, const std::vector<uint32>&);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 template std::vector<char> PmpTestUtil::MakeHeaderAndBody<uint32>( 141 template std::vector<char> PmpTestUtil::MakeHeaderAndBody<uint32>(
142 const PmpFieldType, const uint32, const std::vector<uint32>&); 142 const PmpFieldType, const uint32, const std::vector<uint32>&);
143 template std::vector<char> PmpTestUtil::MakeHeaderAndBody<double>( 143 template std::vector<char> PmpTestUtil::MakeHeaderAndBody<double>(
144 const PmpFieldType, const uint32, const std::vector<double>&); 144 const PmpFieldType, const uint32, const std::vector<double>&);
145 template std::vector<char> PmpTestUtil::MakeHeaderAndBody<uint8>( 145 template std::vector<char> PmpTestUtil::MakeHeaderAndBody<uint8>(
146 const PmpFieldType, const uint32, const std::vector<uint8>&); 146 const PmpFieldType, const uint32, const std::vector<uint8>&);
147 template std::vector<char> PmpTestUtil::MakeHeaderAndBody<uint64>( 147 template std::vector<char> PmpTestUtil::MakeHeaderAndBody<uint64>(
148 const PmpFieldType, const uint32, const std::vector<uint64>&); 148 const PmpFieldType, const uint32, const std::vector<uint64>&);
149 149
150 } // namespace picasa 150 } // namespace picasa
OLDNEW
« no previous file with comments | « chrome/common/media_galleries/picasa_test_util.cc ('k') | chrome/common/net/url_fixer_upper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698