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

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

Issue 2314363002: extensions: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Comment addressed Created 4 years, 3 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/extensions/extension_service_test_with_install.h" 5 #include "chrome/browser/extensions/extension_service_test_with_install.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/extensions/crx_installer.h" 9 #include "chrome/browser/extensions/crx_installer.h"
10 #include "chrome/browser/extensions/extension_creator.h" 10 #include "chrome/browser/extensions/extension_creator.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 98 }
99 99
100 const Extension* ExtensionServiceTestWithInstall::PackAndInstallCRX( 100 const Extension* ExtensionServiceTestWithInstall::PackAndInstallCRX(
101 const base::FilePath& dir_path, 101 const base::FilePath& dir_path,
102 const base::FilePath& pem_path, 102 const base::FilePath& pem_path,
103 InstallState install_state, 103 InstallState install_state,
104 int creation_flags) { 104 int creation_flags) {
105 base::FilePath crx_path; 105 base::FilePath crx_path;
106 base::ScopedTempDir temp_dir; 106 base::ScopedTempDir temp_dir;
107 EXPECT_TRUE(temp_dir.CreateUniqueTempDir()); 107 EXPECT_TRUE(temp_dir.CreateUniqueTempDir());
108 crx_path = temp_dir.path().AppendASCII("temp.crx"); 108 crx_path = temp_dir.GetPath().AppendASCII("temp.crx");
109 109
110 PackCRX(dir_path, pem_path, crx_path); 110 PackCRX(dir_path, pem_path, crx_path);
111 return InstallCRX(crx_path, install_state, creation_flags); 111 return InstallCRX(crx_path, install_state, creation_flags);
112 } 112 }
113 113
114 const Extension* ExtensionServiceTestWithInstall::PackAndInstallCRX( 114 const Extension* ExtensionServiceTestWithInstall::PackAndInstallCRX(
115 const base::FilePath& dir_path, 115 const base::FilePath& dir_path,
116 const base::FilePath& pem_path, 116 const base::FilePath& pem_path,
117 InstallState install_state) { 117 InstallState install_state) {
118 return PackAndInstallCRX(dir_path, pem_path, install_state, 118 return PackAndInstallCRX(dir_path, pem_path, install_state,
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 return extension; 242 return extension;
243 } 243 }
244 244
245 void ExtensionServiceTestWithInstall::PackCRXAndUpdateExtension( 245 void ExtensionServiceTestWithInstall::PackCRXAndUpdateExtension(
246 const std::string& id, 246 const std::string& id,
247 const base::FilePath& dir_path, 247 const base::FilePath& dir_path,
248 const base::FilePath& pem_path, 248 const base::FilePath& pem_path,
249 UpdateState expected_state) { 249 UpdateState expected_state) {
250 base::ScopedTempDir temp_dir; 250 base::ScopedTempDir temp_dir;
251 EXPECT_TRUE(temp_dir.CreateUniqueTempDir()); 251 EXPECT_TRUE(temp_dir.CreateUniqueTempDir());
252 base::FilePath crx_path = temp_dir.path().AppendASCII("temp.crx"); 252 base::FilePath crx_path = temp_dir.GetPath().AppendASCII("temp.crx");
253 253
254 PackCRX(dir_path, pem_path, crx_path); 254 PackCRX(dir_path, pem_path, crx_path);
255 UpdateExtension(id, crx_path, expected_state); 255 UpdateExtension(id, crx_path, expected_state);
256 } 256 }
257 257
258 void ExtensionServiceTestWithInstall::UpdateExtension( 258 void ExtensionServiceTestWithInstall::UpdateExtension(
259 const std::string& id, 259 const std::string& id,
260 const base::FilePath& in_path, 260 const base::FilePath& in_path,
261 UpdateState expected_state) { 261 UpdateState expected_state) {
262 ASSERT_TRUE(base::PathExists(in_path)); 262 ASSERT_TRUE(base::PathExists(in_path));
263 263
264 // We need to copy this to a temporary location because Update() will delete 264 // We need to copy this to a temporary location because Update() will delete
265 // it. 265 // it.
266 base::FilePath path = temp_dir().path(); 266 base::FilePath path = temp_dir().GetPath();
267 path = path.Append(in_path.BaseName()); 267 path = path.Append(in_path.BaseName());
268 ASSERT_TRUE(base::CopyFile(in_path, path)); 268 ASSERT_TRUE(base::CopyFile(in_path, path));
269 269
270 int previous_enabled_extension_count = 270 int previous_enabled_extension_count =
271 registry()->enabled_extensions().size(); 271 registry()->enabled_extensions().size();
272 int previous_installed_extension_count = 272 int previous_installed_extension_count =
273 previous_enabled_extension_count + 273 previous_enabled_extension_count +
274 registry()->disabled_extensions().size(); 274 registry()->disabled_extensions().size();
275 275
276 extensions::CrxInstaller* installer = nullptr; 276 extensions::CrxInstaller* installer = nullptr;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 content::WindowedNotificationObserver observer( 423 content::WindowedNotificationObserver observer(
424 extensions::NOTIFICATION_CRX_INSTALLER_DONE, 424 extensions::NOTIFICATION_CRX_INSTALLER_DONE,
425 content::Source<extensions::CrxInstaller>(installer.get())); 425 content::Source<extensions::CrxInstaller>(installer.get()));
426 426
427 installer->InstallCrx(crx_path); 427 installer->InstallCrx(crx_path);
428 428
429 observer.Wait(); 429 observer.Wait();
430 } 430 }
431 431
432 } // namespace extensions 432 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service_test_base.cc ('k') | chrome/browser/extensions/extension_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698