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