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

Side by Side Diff: chrome/browser/extensions/updater/local_extension_cache_unittest.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 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 "chrome/browser/extensions/updater/local_extension_cache.h" 5 #include "chrome/browser/extensions/updater/local_extension_cache.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 const std::string& version, 72 const std::string& version,
73 size_t size, 73 size_t size,
74 const base::Time& timestamp) { 74 const base::Time& timestamp) {
75 CreateFile(GetExtensionFileName(dir, id, version), size, timestamp); 75 CreateFile(GetExtensionFileName(dir, id, version), size, timestamp);
76 } 76 }
77 77
78 void CreateFile(const base::FilePath& file, 78 void CreateFile(const base::FilePath& file,
79 size_t size, 79 size_t size,
80 const base::Time& timestamp) { 80 const base::Time& timestamp) {
81 std::string data(size, 0); 81 std::string data(size, 0);
82 EXPECT_EQ(file_util::WriteFile(file, data.data(), data.size()), int(size)); 82 EXPECT_EQ(base::WriteFile(file, data.data(), data.size()), int(size));
83 EXPECT_TRUE(base::TouchFile(file, timestamp, timestamp)); 83 EXPECT_TRUE(base::TouchFile(file, timestamp, timestamp));
84 } 84 }
85 85
86 base::FilePath GetExtensionFileName(const base::FilePath& dir, 86 base::FilePath GetExtensionFileName(const base::FilePath& dir,
87 const std::string& id, 87 const std::string& id,
88 const std::string& version) { 88 const std::string& version) {
89 return dir.Append(id + "-" + version + ".crx"); 89 return dir.Append(id + "-" + version + ".crx");
90 } 90 }
91 91
92 void WaitForCompletion() { 92 void WaitForCompletion() {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 163
164 EXPECT_TRUE(base::PathExists( 164 EXPECT_TRUE(base::PathExists(
165 GetExtensionFileName(cache_dir, kTestExtensionId1, "1.0"))); 165 GetExtensionFileName(cache_dir, kTestExtensionId1, "1.0")));
166 EXPECT_FALSE(base::PathExists( 166 EXPECT_FALSE(base::PathExists(
167 GetExtensionFileName(cache_dir, kTestExtensionId2, "2.0"))); 167 GetExtensionFileName(cache_dir, kTestExtensionId2, "2.0")));
168 EXPECT_FALSE(base::PathExists( 168 EXPECT_FALSE(base::PathExists(
169 GetExtensionFileName(cache_dir, kTestExtensionId3, "3.0"))); 169 GetExtensionFileName(cache_dir, kTestExtensionId3, "3.0")));
170 } 170 }
171 171
172 } // namespace extensions 172 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/test_extension_dir.cc ('k') | chrome/browser/extensions/user_script_master_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698