| OLD | NEW |
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 89 } |
| 90 | 90 |
| 91 namespace { | 91 namespace { |
| 92 | 92 |
| 93 Status UnzipArchive(const base::FilePath& unzip_dir, | 93 Status UnzipArchive(const base::FilePath& unzip_dir, |
| 94 const std::string& bytes) { | 94 const std::string& bytes) { |
| 95 base::ScopedTempDir dir; | 95 base::ScopedTempDir dir; |
| 96 if (!dir.CreateUniqueTempDir()) | 96 if (!dir.CreateUniqueTempDir()) |
| 97 return Status(kUnknownError, "unable to create temp dir"); | 97 return Status(kUnknownError, "unable to create temp dir"); |
| 98 | 98 |
| 99 base::FilePath archive = dir.path().AppendASCII("temp.zip"); | 99 base::FilePath archive = dir.GetPath().AppendASCII("temp.zip"); |
| 100 int length = bytes.length(); | 100 int length = bytes.length(); |
| 101 if (base::WriteFile(archive, bytes.c_str(), length) != length) | 101 if (base::WriteFile(archive, bytes.c_str(), length) != length) |
| 102 return Status(kUnknownError, "could not write file to temp dir"); | 102 return Status(kUnknownError, "could not write file to temp dir"); |
| 103 | 103 |
| 104 if (!zip::Unzip(archive, unzip_dir)) | 104 if (!zip::Unzip(archive, unzip_dir)) |
| 105 return Status(kUnknownError, "could not unzip archive"); | 105 return Status(kUnknownError, "could not unzip archive"); |
| 106 return Status(kOk); | 106 return Status(kOk); |
| 107 } | 107 } |
| 108 | 108 |
| 109 // Stream for writing binary data. | 109 // Stream for writing binary data. |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 if (session->chrome) { | 427 if (session->chrome) { |
| 428 const BrowserInfo* browser_info = session->chrome->GetBrowserInfo(); | 428 const BrowserInfo* browser_info = session->chrome->GetBrowserInfo(); |
| 429 status.AddDetails("Session info: " + browser_info->browser_name + "=" + | 429 status.AddDetails("Session info: " + browser_info->browser_name + "=" + |
| 430 browser_info->browser_version); | 430 browser_info->browser_version); |
| 431 } | 431 } |
| 432 return status; | 432 return status; |
| 433 } | 433 } |
| 434 } | 434 } |
| 435 return Status(kOk); | 435 return Status(kOk); |
| 436 } | 436 } |
| OLD | NEW |