OLD | NEW |
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/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 std::string archive_error, entry_error; | 366 std::string archive_error, entry_error; |
367 if (!UnzipArchive(unzip_dir, bytes, &archive_error) && | 367 if (!UnzipArchive(unzip_dir, bytes, &archive_error) && |
368 !UnzipEntry(unzip_dir, bytes, &entry_error)) { | 368 !UnzipEntry(unzip_dir, bytes, &entry_error)) { |
369 *error_msg = base::StringPrintf( | 369 *error_msg = base::StringPrintf( |
370 "Failed to unzip file: Archive error: (%s) Entry error: (%s)", | 370 "Failed to unzip file: Archive error: (%s) Entry error: (%s)", |
371 archive_error.c_str(), entry_error.c_str()); | 371 archive_error.c_str(), entry_error.c_str()); |
372 return false; | 372 return false; |
373 } | 373 } |
374 | 374 |
375 file_util::FileEnumerator enumerator(unzip_dir, false /* recursive */, | 375 file_util::FileEnumerator enumerator(unzip_dir, false /* recursive */, |
376 static_cast<file_util::FileEnumerator::FileType>( | 376 file_util::FileEnumerator::FILES | |
377 file_util::FileEnumerator::FILES | | 377 file_util::FileEnumerator::DIRECTORIES); |
378 file_util::FileEnumerator::DIRECTORIES)); | |
379 FilePath first_file = enumerator.Next(); | 378 FilePath first_file = enumerator.Next(); |
380 if (first_file.empty()) { | 379 if (first_file.empty()) { |
381 *error_msg = "Zip contained 0 files"; | 380 *error_msg = "Zip contained 0 files"; |
382 return false; | 381 return false; |
383 } | 382 } |
384 FilePath second_file = enumerator.Next(); | 383 FilePath second_file = enumerator.Next(); |
385 if (!second_file.empty()) { | 384 if (!second_file.empty()) { |
386 *error_msg = "Zip contained multiple files"; | 385 *error_msg = "Zip contained multiple files"; |
387 return false; | 386 return false; |
388 } | 387 } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 | 550 |
552 bool ValueConversionTraits<webdriver::SkipParsing>::SetFromValue( | 551 bool ValueConversionTraits<webdriver::SkipParsing>::SetFromValue( |
553 const Value* value, const webdriver::SkipParsing* t) { | 552 const Value* value, const webdriver::SkipParsing* t) { |
554 return true; | 553 return true; |
555 } | 554 } |
556 | 555 |
557 bool ValueConversionTraits<webdriver::SkipParsing>::CanConvert( | 556 bool ValueConversionTraits<webdriver::SkipParsing>::CanConvert( |
558 const Value* value) { | 557 const Value* value) { |
559 return true; | 558 return true; |
560 } | 559 } |
OLD | NEW |