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

Side by Side Diff: base/test/test_file_util_win.cc

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | « base/test/gtest_xml_util.cc ('k') | cc/test/pixel_test_utils.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 "base/test/test_file_util.h" 5 #include "base/test/test_file_util.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <aclapi.h> 8 #include <aclapi.h>
9 #include <shlwapi.h> 9 #include <shlwapi.h>
10 10
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 234
235 return false; 235 return false;
236 } 236 }
237 237
238 // Return whether the ZoneIdentifier is correctly set to "Internet" (3) 238 // Return whether the ZoneIdentifier is correctly set to "Internet" (3)
239 // Only returns a valid result when called from same process as the 239 // Only returns a valid result when called from same process as the
240 // one that (was supposed to have) set the zone identifier. 240 // one that (was supposed to have) set the zone identifier.
241 bool HasInternetZoneIdentifier(const base::FilePath& full_path) { 241 bool HasInternetZoneIdentifier(const base::FilePath& full_path) {
242 base::FilePath zone_path(full_path.value() + L":Zone.Identifier"); 242 base::FilePath zone_path(full_path.value() + L":Zone.Identifier");
243 std::string zone_path_contents; 243 std::string zone_path_contents;
244 if (!file_util::ReadFileToString(zone_path, &zone_path_contents)) 244 if (!base::ReadFileToString(zone_path, &zone_path_contents))
245 return false; 245 return false;
246 246
247 std::vector<std::string> lines; 247 std::vector<std::string> lines;
248 // This call also trims whitespaces, including carriage-returns (\r). 248 // This call also trims whitespaces, including carriage-returns (\r).
249 base::SplitString(zone_path_contents, '\n', &lines); 249 base::SplitString(zone_path_contents, '\n', &lines);
250 250
251 switch (lines.size()) { 251 switch (lines.size()) {
252 case 3: 252 case 3:
253 // optional empty line at end of file: 253 // optional empty line at end of file:
254 if (lines[2] != "") 254 if (lines[2] != "")
(...skipping 27 matching lines...) Expand all
282 DCHECK(info_ != NULL); 282 DCHECK(info_ != NULL);
283 DCHECK_NE(0u, length_); 283 DCHECK_NE(0u, length_);
284 } 284 }
285 285
286 PermissionRestorer::~PermissionRestorer() { 286 PermissionRestorer::~PermissionRestorer() {
287 if (!RestorePermissionInfo(path_, info_, length_)) 287 if (!RestorePermissionInfo(path_, info_, length_))
288 NOTREACHED(); 288 NOTREACHED();
289 } 289 }
290 290
291 } // namespace file_util 291 } // namespace file_util
OLDNEW
« no previous file with comments | « base/test/gtest_xml_util.cc ('k') | cc/test/pixel_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698