| 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/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 7 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 8 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 9 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 10 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 11 #include "base/values.h" | 12 #include "base/values.h" |
| 12 #include "chrome/browser/extensions/sandboxed_unpacker.h" | 13 #include "chrome/browser/extensions/sandboxed_unpacker.h" |
| 13 #include "chrome/common/chrome_paths.h" | 14 #include "chrome/common/chrome_paths.h" |
| 14 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
| 15 #include "chrome/common/extensions/unpacker.h" | 16 #include "chrome/common/extensions/unpacker.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 *unpacker_->parsed_manifest()); | 126 *unpacker_->parsed_manifest()); |
| 126 } | 127 } |
| 127 | 128 |
| 128 base::FilePath GetInstallPath() { | 129 base::FilePath GetInstallPath() { |
| 129 return temp_dir_.path().AppendASCII( | 130 return temp_dir_.path().AppendASCII( |
| 130 extension_filenames::kTempExtensionName); | 131 extension_filenames::kTempExtensionName); |
| 131 } | 132 } |
| 132 | 133 |
| 133 bool TempFilesRemoved() { | 134 bool TempFilesRemoved() { |
| 134 // Check that temporary files were cleaned up. | 135 // Check that temporary files were cleaned up. |
| 135 int files_and_dirs = file_util::FileEnumerator::DIRECTORIES | | 136 int files_and_dirs = base::FileEnumerator::DIRECTORIES | |
| 136 file_util::FileEnumerator::FILES; | 137 base::FileEnumerator::FILES; |
| 137 | 138 |
| 138 file_util::FileEnumerator temp_iterator( | 139 base::FileEnumerator temp_iterator( |
| 139 temp_path_, | 140 temp_path_, |
| 140 true, // recursive | 141 true, // recursive |
| 141 files_and_dirs | 142 files_and_dirs |
| 142 ); | 143 ); |
| 143 int items_not_removed = 0; | 144 int items_not_removed = 0; |
| 144 base::FilePath item_in_temp; | 145 base::FilePath item_in_temp; |
| 145 item_in_temp = temp_iterator.Next(); | 146 item_in_temp = temp_iterator.Next(); |
| 146 while (!item_in_temp.value().empty()) { | 147 while (!item_in_temp.value().empty()) { |
| 147 items_not_removed++; | 148 items_not_removed++; |
| 148 EXPECT_STREQ(FILE_PATH_LITERAL(""), item_in_temp.value().c_str()) | 149 EXPECT_STREQ(FILE_PATH_LITERAL(""), item_in_temp.value().c_str()) |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // Check that there is newer _locales/en_US/messages.json file. | 213 // Check that there is newer _locales/en_US/messages.json file. |
| 213 base::PlatformFileInfo new_info; | 214 base::PlatformFileInfo new_info; |
| 214 EXPECT_TRUE(file_util::GetFileInfo(messages_file, &new_info)); | 215 EXPECT_TRUE(file_util::GetFileInfo(messages_file, &new_info)); |
| 215 | 216 |
| 216 EXPECT_TRUE(new_info.last_modified > old_info.last_modified); | 217 EXPECT_TRUE(new_info.last_modified > old_info.last_modified); |
| 217 | 218 |
| 218 ASSERT_TRUE(TempFilesRemoved()); | 219 ASSERT_TRUE(TempFilesRemoved()); |
| 219 } | 220 } |
| 220 | 221 |
| 221 } // namespace extensions | 222 } // namespace extensions |
| OLD | NEW |