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

Side by Side Diff: chrome/test/webdriver/webdriver_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/ui/ui_test.cc ('k') | chrome_frame/test/reliability/page_load_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) 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 "chrome/test/webdriver/webdriver_util.h" 5 #include "chrome/test/webdriver/webdriver_util.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_enumerator.h"
10 #include "base/files/scoped_temp_dir.h" 11 #include "base/files/scoped_temp_dir.h"
11 #include "base/format_macros.h" 12 #include "base/format_macros.h"
12 #include "base/json/json_reader.h" 13 #include "base/json/json_reader.h"
13 #include "base/json/json_writer.h" 14 #include "base/json/json_writer.h"
14 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
15 #include "base/rand_util.h" 16 #include "base/rand_util.h"
16 #include "base/string_util.h" 17 #include "base/string_util.h"
17 #include "base/stringprintf.h" 18 #include "base/stringprintf.h"
18 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
19 #include "base/strings/string_split.h" 20 #include "base/strings/string_split.h"
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 std::string* error_msg) { 366 std::string* error_msg) {
366 std::string archive_error, entry_error; 367 std::string archive_error, entry_error;
367 if (!UnzipArchive(unzip_dir, bytes, &archive_error) && 368 if (!UnzipArchive(unzip_dir, bytes, &archive_error) &&
368 !UnzipEntry(unzip_dir, bytes, &entry_error)) { 369 !UnzipEntry(unzip_dir, bytes, &entry_error)) {
369 *error_msg = base::StringPrintf( 370 *error_msg = base::StringPrintf(
370 "Failed to unzip file: Archive error: (%s) Entry error: (%s)", 371 "Failed to unzip file: Archive error: (%s) Entry error: (%s)",
371 archive_error.c_str(), entry_error.c_str()); 372 archive_error.c_str(), entry_error.c_str());
372 return false; 373 return false;
373 } 374 }
374 375
375 file_util::FileEnumerator enumerator(unzip_dir, false /* recursive */, 376 base::FileEnumerator enumerator(unzip_dir, false /* recursive */,
376 file_util::FileEnumerator::FILES | 377 base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES);
377 file_util::FileEnumerator::DIRECTORIES);
378 base::FilePath first_file = enumerator.Next(); 378 base::FilePath first_file = enumerator.Next();
379 if (first_file.empty()) { 379 if (first_file.empty()) {
380 *error_msg = "Zip contained 0 files"; 380 *error_msg = "Zip contained 0 files";
381 return false; 381 return false;
382 } 382 }
383 base::FilePath second_file = enumerator.Next(); 383 base::FilePath second_file = enumerator.Next();
384 if (!second_file.empty()) { 384 if (!second_file.empty()) {
385 *error_msg = "Zip contained multiple files"; 385 *error_msg = "Zip contained multiple files";
386 return false; 386 return false;
387 } 387 }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 548
549 bool ValueConversionTraits<webdriver::SkipParsing>::SetFromValue( 549 bool ValueConversionTraits<webdriver::SkipParsing>::SetFromValue(
550 const Value* value, const webdriver::SkipParsing* t) { 550 const Value* value, const webdriver::SkipParsing* t) {
551 return true; 551 return true;
552 } 552 }
553 553
554 bool ValueConversionTraits<webdriver::SkipParsing>::CanConvert( 554 bool ValueConversionTraits<webdriver::SkipParsing>::CanConvert(
555 const Value* value) { 555 const Value* value) {
556 return true; 556 return true;
557 } 557 }
OLDNEW
« no previous file with comments | « chrome/test/ui/ui_test.cc ('k') | chrome_frame/test/reliability/page_load_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698