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

Side by Side Diff: chrome/test/chromedriver/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
« no previous file with comments | « chrome/test/chromedriver/chrome_launcher.cc ('k') | chrome/test/perf/startup_test.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/test/chromedriver/util.h" 5 #include "chrome/test/chromedriver/util.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_enumerator.h" 9 #include "base/files/file_enumerator.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 namespace { 83 namespace {
84 84
85 Status UnzipArchive(const base::FilePath& unzip_dir, 85 Status UnzipArchive(const base::FilePath& unzip_dir,
86 const std::string& bytes) { 86 const std::string& bytes) {
87 base::ScopedTempDir dir; 87 base::ScopedTempDir dir;
88 if (!dir.CreateUniqueTempDir()) 88 if (!dir.CreateUniqueTempDir())
89 return Status(kUnknownError, "unable to create temp dir"); 89 return Status(kUnknownError, "unable to create temp dir");
90 90
91 base::FilePath archive = dir.path().AppendASCII("temp.zip"); 91 base::FilePath archive = dir.path().AppendASCII("temp.zip");
92 int length = bytes.length(); 92 int length = bytes.length();
93 if (file_util::WriteFile(archive, bytes.c_str(), length) != length) 93 if (base::WriteFile(archive, bytes.c_str(), length) != length)
94 return Status(kUnknownError, "could not write file to temp dir"); 94 return Status(kUnknownError, "could not write file to temp dir");
95 95
96 if (!zip::Unzip(archive, unzip_dir)) 96 if (!zip::Unzip(archive, unzip_dir))
97 return Status(kUnknownError, "could not unzip archive"); 97 return Status(kUnknownError, "could not unzip archive");
98 return Status(kOk); 98 return Status(kOk);
99 } 99 }
100 100
101 // Stream for writing binary data. 101 // Stream for writing binary data.
102 class DataOutputStream { 102 class DataOutputStream {
103 public: 103 public:
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 if (first_file.empty()) 394 if (first_file.empty())
395 return Status(kUnknownError, "contained 0 files"); 395 return Status(kUnknownError, "contained 0 files");
396 396
397 base::FilePath second_file = enumerator.Next(); 397 base::FilePath second_file = enumerator.Next();
398 if (!second_file.empty()) 398 if (!second_file.empty())
399 return Status(kUnknownError, "contained multiple files"); 399 return Status(kUnknownError, "contained multiple files");
400 400
401 *file = first_file; 401 *file = first_file;
402 return Status(kOk); 402 return Status(kOk);
403 } 403 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/chrome_launcher.cc ('k') | chrome/test/perf/startup_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698