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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/file_util.h" | |
9 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
11 #include "chrome/test/chromedriver/chrome/status.h" | 11 #include "chrome/test/chromedriver/chrome/status.h" |
12 #include "chrome/test/chromedriver/util.h" | 12 #include "chrome/test/chromedriver/util.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 TEST(UnzipSoleFile, Entry) { | 15 TEST(UnzipSoleFile, Entry) { |
16 base::ScopedTempDir temp_dir; | 16 base::ScopedTempDir temp_dir; |
17 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 17 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
18 std::string data; | 18 std::string data; |
19 // A zip entry sent from a Java WebDriver client (v2.20) that contains a | 19 // A zip entry sent from a Java WebDriver client (v2.20) that contains a |
(...skipping 21 matching lines...) Expand all Loading... |
41 "wAzGBAAAAAQAAAADAAAAAAAAAAAAAACggQAAAABtb29QSwUGAAAAAAEAAQAxAAAAJQAAAAA" | 41 "wAzGBAAAAAQAAAADAAAAAAAAAAAAAACggQAAAABtb29QSwUGAAAAAAEAAQAxAAAAJQAAAAA" |
42 "A"; | 42 "A"; |
43 ASSERT_TRUE(base::Base64Decode(kBase64ZipArchive, &data)); | 43 ASSERT_TRUE(base::Base64Decode(kBase64ZipArchive, &data)); |
44 base::FilePath file; | 44 base::FilePath file; |
45 Status status = UnzipSoleFile(temp_dir.path(), data, &file); | 45 Status status = UnzipSoleFile(temp_dir.path(), data, &file); |
46 ASSERT_EQ(kOk, status.code()) << status.message(); | 46 ASSERT_EQ(kOk, status.code()) << status.message(); |
47 std::string contents; | 47 std::string contents; |
48 ASSERT_TRUE(base::ReadFileToString(file, &contents)); | 48 ASSERT_TRUE(base::ReadFileToString(file, &contents)); |
49 ASSERT_STREQ("COW\n", contents.c_str()); | 49 ASSERT_STREQ("COW\n", contents.c_str()); |
50 } | 50 } |
OLD | NEW |