| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/ref_counted.h" | 7 #include "base/ref_counted.h" |
| 8 #include "base/scoped_temp_dir.h" | 8 #include "base/scoped_temp_dir.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 original_path = original_path.AppendASCII("extensions") | 69 original_path = original_path.AppendASCII("extensions") |
| 70 .AppendASCII("unpacker") | 70 .AppendASCII("unpacker") |
| 71 .AppendASCII(crx_name); | 71 .AppendASCII(crx_name); |
| 72 ASSERT_TRUE(file_util::PathExists(original_path)) << original_path.value(); | 72 ASSERT_TRUE(file_util::PathExists(original_path)) << original_path.value(); |
| 73 | 73 |
| 74 // Try bots won't let us write into DIR_TEST_DATA, so we have to create | 74 // Try bots won't let us write into DIR_TEST_DATA, so we have to create |
| 75 // a temp folder to play in. | 75 // a temp folder to play in. |
| 76 ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &install_dir_)); | 76 ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &install_dir_)); |
| 77 install_dir_ = | 77 install_dir_ = |
| 78 install_dir_.AppendASCII("sandboxed_extension_unpacker_test"); | 78 install_dir_.AppendASCII("sandboxed_extension_unpacker_test"); |
| 79 ASSERT_TRUE(file_util::Delete(install_dir_, true)) << | 79 file_util::Delete(install_dir_, true); |
| 80 install_dir_.value(); | 80 file_util::CreateDirectory(install_dir_); |
| 81 ASSERT_TRUE(file_util::CreateDirectory(install_dir_)) << | |
| 82 install_dir_.value(); | |
| 83 | 81 |
| 84 FilePath crx_path = install_dir_.AppendASCII(crx_name); | 82 FilePath crx_path = install_dir_.AppendASCII(crx_name); |
| 85 ASSERT_TRUE(file_util::CopyFile(original_path, crx_path)) << | 83 ASSERT_TRUE(file_util::CopyFile(original_path, crx_path)) << |
| 86 "Original path: " << original_path.value() << | 84 "Original path: " << original_path.value() << |
| 87 ", Crx path: " << crx_path.value(); | 85 ", Crx path: " << crx_path.value(); |
| 88 | 86 |
| 89 unpacker_.reset(new ExtensionUnpacker(crx_path)); | 87 unpacker_.reset(new ExtensionUnpacker(crx_path)); |
| 90 | 88 |
| 91 // It will delete itself. | 89 // It will delete itself. |
| 92 sandboxed_unpacker_ = | 90 sandboxed_unpacker_ = |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 .AppendASCII(Extension::kLocaleFolder) | 149 .AppendASCII(Extension::kLocaleFolder) |
| 152 .AppendASCII("en_US") | 150 .AppendASCII("en_US") |
| 153 .AppendASCII(Extension::kMessagesFilename); | 151 .AppendASCII(Extension::kMessagesFilename); |
| 154 EXPECT_TRUE(file_util::Delete(messages_file, false)); | 152 EXPECT_TRUE(file_util::Delete(messages_file, false)); |
| 155 | 153 |
| 156 OnUnpackSucceeded(); | 154 OnUnpackSucceeded(); |
| 157 | 155 |
| 158 // Check that there is _locales/en_US/messages.json file. | 156 // Check that there is _locales/en_US/messages.json file. |
| 159 EXPECT_TRUE(file_util::PathExists(messages_file)); | 157 EXPECT_TRUE(file_util::PathExists(messages_file)); |
| 160 } | 158 } |
| OLD | NEW |