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/session_commands.h" | 5 #include "chrome/test/chromedriver/session_commands.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 return Status(kUnknownError, "missing or invalid 'file'"); | 585 return Status(kUnknownError, "missing or invalid 'file'"); |
586 std::string zip_data; | 586 std::string zip_data; |
587 if (!Base64Decode(base64_zip_data, &zip_data)) | 587 if (!Base64Decode(base64_zip_data, &zip_data)) |
588 return Status(kUnknownError, "unable to decode 'file'"); | 588 return Status(kUnknownError, "unable to decode 'file'"); |
589 | 589 |
590 if (!session->temp_dir.IsValid()) { | 590 if (!session->temp_dir.IsValid()) { |
591 if (!session->temp_dir.CreateUniqueTempDir()) | 591 if (!session->temp_dir.CreateUniqueTempDir()) |
592 return Status(kUnknownError, "unable to create temp dir"); | 592 return Status(kUnknownError, "unable to create temp dir"); |
593 } | 593 } |
594 base::FilePath upload_dir; | 594 base::FilePath upload_dir; |
595 if (!file_util::CreateTemporaryDirInDir( | 595 if (!base::CreateTemporaryDirInDir(session->temp_dir.path(), |
596 session->temp_dir.path(), FILE_PATH_LITERAL("upload"), &upload_dir)) { | 596 FILE_PATH_LITERAL("upload"), |
| 597 &upload_dir)) { |
597 return Status(kUnknownError, "unable to create temp dir"); | 598 return Status(kUnknownError, "unable to create temp dir"); |
598 } | 599 } |
599 std::string error_msg; | 600 std::string error_msg; |
600 base::FilePath upload; | 601 base::FilePath upload; |
601 Status status = UnzipSoleFile(upload_dir, zip_data, &upload); | 602 Status status = UnzipSoleFile(upload_dir, zip_data, &upload); |
602 if (status.IsError()) | 603 if (status.IsError()) |
603 return Status(kUnknownError, "unable to unzip 'file'", status); | 604 return Status(kUnknownError, "unable to unzip 'file'", status); |
604 | 605 |
605 value->reset(new base::StringValue(upload.value())); | 606 value->reset(new base::StringValue(upload.value())); |
606 return Status(kOk); | 607 return Status(kOk); |
607 } | 608 } |
OLD | NEW |