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 "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/files/file_enumerator.h" | 6 #include "base/files/file_enumerator.h" |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &original_path)); | 81 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &original_path)); |
82 original_path = original_path.AppendASCII("extensions") | 82 original_path = original_path.AppendASCII("extensions") |
83 .AppendASCII("unpacker") | 83 .AppendASCII("unpacker") |
84 .AppendASCII(crx_name); | 84 .AppendASCII(crx_name); |
85 ASSERT_TRUE(file_util::PathExists(original_path)) << original_path.value(); | 85 ASSERT_TRUE(file_util::PathExists(original_path)) << original_path.value(); |
86 | 86 |
87 // Try bots won't let us write into DIR_TEST_DATA, so we have to write the | 87 // Try bots won't let us write into DIR_TEST_DATA, so we have to write the |
88 // CRX to the temp directory, and create a subdirectory into which to | 88 // CRX to the temp directory, and create a subdirectory into which to |
89 // unpack it. | 89 // unpack it. |
90 base::FilePath crx_path = temp_dir_.path().AppendASCII(crx_name); | 90 base::FilePath crx_path = temp_dir_.path().AppendASCII(crx_name); |
91 ASSERT_TRUE(file_util::CopyFile(original_path, crx_path)) << | 91 ASSERT_TRUE(base::CopyFile(original_path, crx_path)) << |
92 "Original path: " << original_path.value() << | 92 "Original path: " << original_path.value() << |
93 ", Crx path: " << crx_path.value(); | 93 ", Crx path: " << crx_path.value(); |
94 | 94 |
95 unpacker_.reset(new Unpacker( | 95 unpacker_.reset(new Unpacker( |
96 crx_path, std::string(), Manifest::INTERNAL, Extension::NO_FLAGS)); | 96 crx_path, std::string(), Manifest::INTERNAL, Extension::NO_FLAGS)); |
97 | 97 |
98 // Build a temp area where the extension will be unpacked. | 98 // Build a temp area where the extension will be unpacked. |
99 temp_path_ = | 99 temp_path_ = |
100 temp_dir_.path().AppendASCII("sandboxed_unpacker_test_Temp"); | 100 temp_dir_.path().AppendASCII("sandboxed_unpacker_test_Temp"); |
101 ASSERT_TRUE(file_util::CreateDirectory(temp_path_)); | 101 ASSERT_TRUE(file_util::CreateDirectory(temp_path_)); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // Check that there is newer _locales/en_US/messages.json file. | 215 // Check that there is newer _locales/en_US/messages.json file. |
216 base::PlatformFileInfo new_info; | 216 base::PlatformFileInfo new_info; |
217 EXPECT_TRUE(file_util::GetFileInfo(messages_file, &new_info)); | 217 EXPECT_TRUE(file_util::GetFileInfo(messages_file, &new_info)); |
218 | 218 |
219 EXPECT_TRUE(new_info.last_modified > old_info.last_modified); | 219 EXPECT_TRUE(new_info.last_modified > old_info.last_modified); |
220 | 220 |
221 ASSERT_TRUE(TempFilesRemoved()); | 221 ASSERT_TRUE(TempFilesRemoved()); |
222 } | 222 } |
223 | 223 |
224 } // namespace extensions | 224 } // namespace extensions |
OLD | NEW |