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

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

Issue 15984016: Call scoped_refptr<T>::get() rather than relying on implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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
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/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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_));
102 102
103 sandboxed_unpacker_ = 103 sandboxed_unpacker_ = new SandboxedUnpacker(
104 new SandboxedUnpacker( 104 crx_path,
105 crx_path, false, Manifest::INTERNAL, Extension::NO_FLAGS, 105 false,
106 extensions_dir_.path(), 106 Manifest::INTERNAL,
107 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), 107 Extension::NO_FLAGS,
108 client_); 108 extensions_dir_.path(),
109 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE).get(),
110 client_);
109 111
110 EXPECT_TRUE(PrepareUnpackerEnv()); 112 EXPECT_TRUE(PrepareUnpackerEnv());
111 } 113 }
112 114
113 bool PrepareUnpackerEnv() { 115 bool PrepareUnpackerEnv() {
114 sandboxed_unpacker_->extension_root_ = 116 sandboxed_unpacker_->extension_root_ =
115 temp_dir_.path().AppendASCII(extension_filenames::kTempExtensionName); 117 temp_dir_.path().AppendASCII(extension_filenames::kTempExtensionName);
116 118
117 if (!sandboxed_unpacker_->temp_dir_.Set(temp_dir_.path())) 119 if (!sandboxed_unpacker_->temp_dir_.Set(temp_dir_.path()))
118 return false; 120 return false;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // Check that there is newer _locales/en_US/messages.json file. 215 // Check that there is newer _locales/en_US/messages.json file.
214 base::PlatformFileInfo new_info; 216 base::PlatformFileInfo new_info;
215 EXPECT_TRUE(file_util::GetFileInfo(messages_file, &new_info)); 217 EXPECT_TRUE(file_util::GetFileInfo(messages_file, &new_info));
216 218
217 EXPECT_TRUE(new_info.last_modified > old_info.last_modified); 219 EXPECT_TRUE(new_info.last_modified > old_info.last_modified);
218 220
219 ASSERT_TRUE(TempFilesRemoved()); 221 ASSERT_TRUE(TempFilesRemoved());
220 } 222 }
221 223
222 } // namespace extensions 224 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698