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

Side by Side Diff: chrome/test/chromedriver/util.cc

Issue 16392011: Move FileEnumerator to its own file, do some refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix incorrect includes Created 7 years, 6 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/zip.cc ('k') | chrome/test/gpu/gpu_pixel_browsertest.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/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
10 #include "base/format_macros.h" 11 #include "base/format_macros.h"
11 #include "base/rand_util.h" 12 #include "base/rand_util.h"
12 #include "base/string16.h" 13 #include "base/string16.h"
13 #include "base/string_util.h" 14 #include "base/string_util.h"
14 #include "base/stringprintf.h" 15 #include "base/stringprintf.h"
15 #include "base/third_party/icu/icu_utf.h" 16 #include "base/third_party/icu/icu_utf.h"
16 #include "base/values.h" 17 #include "base/values.h"
17 #include "chrome/test/chromedriver/chrome/status.h" 18 #include "chrome/test/chromedriver/chrome/status.h"
18 #include "chrome/test/chromedriver/chrome/ui_events.h" 19 #include "chrome/test/chromedriver/chrome/ui_events.h"
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 Status status = UnzipArchive(unzip_dir, bytes); 377 Status status = UnzipArchive(unzip_dir, bytes);
377 if (status.IsError()) { 378 if (status.IsError()) {
378 Status entry_status = UnzipEntry(unzip_dir, bytes); 379 Status entry_status = UnzipEntry(unzip_dir, bytes);
379 if (entry_status.IsError()) { 380 if (entry_status.IsError()) {
380 return Status(kUnknownError, base::StringPrintf( 381 return Status(kUnknownError, base::StringPrintf(
381 "archive error: (%s), entry error: (%s)", 382 "archive error: (%s), entry error: (%s)",
382 status.message().c_str(), entry_status.message().c_str())); 383 status.message().c_str(), entry_status.message().c_str()));
383 } 384 }
384 } 385 }
385 386
386 file_util::FileEnumerator enumerator(unzip_dir, false /* recursive */, 387 base::FileEnumerator enumerator(unzip_dir, false /* recursive */,
387 file_util::FileEnumerator::FILES | 388 base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES);
388 file_util::FileEnumerator::DIRECTORIES);
389 base::FilePath first_file = enumerator.Next(); 389 base::FilePath first_file = enumerator.Next();
390 if (first_file.empty()) 390 if (first_file.empty())
391 return Status(kUnknownError, "contained 0 files"); 391 return Status(kUnknownError, "contained 0 files");
392 392
393 base::FilePath second_file = enumerator.Next(); 393 base::FilePath second_file = enumerator.Next();
394 if (!second_file.empty()) 394 if (!second_file.empty())
395 return Status(kUnknownError, "contained multiple files"); 395 return Status(kUnknownError, "contained multiple files");
396 396
397 *file = first_file; 397 *file = first_file;
398 return Status(kOk); 398 return Status(kOk);
399 } 399 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/chrome/zip.cc ('k') | chrome/test/gpu/gpu_pixel_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698