| 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/files/scoped_temp_dir.h" |
| 10 #include "base/format_macros.h" | 11 #include "base/format_macros.h" |
| 11 #include "base/json/json_reader.h" | 12 #include "base/json/json_reader.h" |
| 12 #include "base/json/json_writer.h" | 13 #include "base/json/json_writer.h" |
| 13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/rand_util.h" | 15 #include "base/rand_util.h" |
| 15 #include "base/scoped_temp_dir.h" | |
| 16 #include "base/stringprintf.h" | |
| 17 #include "base/string_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
| 18 #include "base/string_split.h" | 17 #include "base/string_split.h" |
| 19 #include "base/string_util.h" | 18 #include "base/string_util.h" |
| 19 #include "base/stringprintf.h" |
| 20 #include "base/third_party/icu/icu_utf.h" | 20 #include "base/third_party/icu/icu_utf.h" |
| 21 #include "chrome/common/automation_id.h" | 21 #include "chrome/common/automation_id.h" |
| 22 #include "chrome/common/zip.h" | 22 #include "chrome/common/zip.h" |
| 23 #include "chrome/test/automation/automation_json_requests.h" | 23 #include "chrome/test/automation/automation_json_requests.h" |
| 24 | 24 |
| 25 using base::DictionaryValue; | 25 using base::DictionaryValue; |
| 26 using base::ListValue; | 26 using base::ListValue; |
| 27 using base::Value; | 27 using base::Value; |
| 28 | 28 |
| 29 namespace webdriver { | 29 namespace webdriver { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 44 // newlines. | 44 // newlines. |
| 45 RemoveChars(copy, "\n", ©); | 45 RemoveChars(copy, "\n", ©); |
| 46 return base::Base64Decode(copy, bytes); | 46 return base::Base64Decode(copy, bytes); |
| 47 } | 47 } |
| 48 | 48 |
| 49 namespace { | 49 namespace { |
| 50 | 50 |
| 51 bool UnzipArchive(const FilePath& unzip_dir, | 51 bool UnzipArchive(const FilePath& unzip_dir, |
| 52 const std::string& bytes, | 52 const std::string& bytes, |
| 53 std::string* error_msg) { | 53 std::string* error_msg) { |
| 54 ScopedTempDir dir; | 54 base::ScopedTempDir dir; |
| 55 if (!dir.CreateUniqueTempDir()) { | 55 if (!dir.CreateUniqueTempDir()) { |
| 56 *error_msg = "Unable to create temp dir"; | 56 *error_msg = "Unable to create temp dir"; |
| 57 return false; | 57 return false; |
| 58 } | 58 } |
| 59 FilePath archive = dir.path().AppendASCII("temp.zip"); | 59 FilePath archive = dir.path().AppendASCII("temp.zip"); |
| 60 int length = bytes.length(); | 60 int length = bytes.length(); |
| 61 if (file_util::WriteFile(archive, bytes.c_str(), length) != length) { | 61 if (file_util::WriteFile(archive, bytes.c_str(), length) != length) { |
| 62 *error_msg = "Could not write file to temp dir"; | 62 *error_msg = "Could not write file to temp dir"; |
| 63 return false; | 63 return false; |
| 64 } | 64 } |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 | 550 |
| 551 bool ValueConversionTraits<webdriver::SkipParsing>::SetFromValue( | 551 bool ValueConversionTraits<webdriver::SkipParsing>::SetFromValue( |
| 552 const Value* value, const webdriver::SkipParsing* t) { | 552 const Value* value, const webdriver::SkipParsing* t) { |
| 553 return true; | 553 return true; |
| 554 } | 554 } |
| 555 | 555 |
| 556 bool ValueConversionTraits<webdriver::SkipParsing>::CanConvert( | 556 bool ValueConversionTraits<webdriver::SkipParsing>::CanConvert( |
| 557 const Value* value) { | 557 const Value* value) { |
| 558 return true; | 558 return true; |
| 559 } | 559 } |
| OLD | NEW |