Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(540)

Side by Side Diff: chrome/browser/extensions/sandboxed_unpacker_unittest.cc

Issue 13165005: Move FileEnumerator to its own file, do some refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge, fixes Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/external_pref_loader.cc ('k') | chrome/browser/file_select_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/extensions/external_pref_loader.cc ('k') | chrome/browser/file_select_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698