OLD | NEW |
---|---|
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 Extension::NO_FLAGS); | 119 Extension::NO_FLAGS); |
120 } | 120 } |
121 | 121 |
122 const Extension* ExtensionServiceTestWithInstall::PackAndInstallCRX( | 122 const Extension* ExtensionServiceTestWithInstall::PackAndInstallCRX( |
123 const base::FilePath& dir_path, | 123 const base::FilePath& dir_path, |
124 InstallState install_state) { | 124 InstallState install_state) { |
125 return PackAndInstallCRX(dir_path, base::FilePath(), install_state, | 125 return PackAndInstallCRX(dir_path, base::FilePath(), install_state, |
126 Extension::NO_FLAGS); | 126 Extension::NO_FLAGS); |
127 } | 127 } |
128 | 128 |
129 const Extension* ExtensionServiceTestWithInstall::PackAndInstallCRXWithLocation( | |
130 const base::FilePath& dir_path, | |
131 Manifest::Location location, | |
132 InstallState install_state) { | |
133 base::FilePath crx_path; | |
Devlin
2015/12/18 22:29:02
I'd say that we should instead be currying the loc
Evan Stade
2015/12/19 00:02:40
Done.
| |
134 base::ScopedTempDir temp_dir; | |
135 EXPECT_TRUE(temp_dir.CreateUniqueTempDir()); | |
136 crx_path = temp_dir.path().AppendASCII("temp.crx"); | |
137 | |
138 PackCRX(dir_path, base::FilePath(), crx_path); | |
139 return InstallCRXWithLocation(crx_path, location, install_state); | |
140 } | |
141 | |
129 // Attempts to install an extension. Use INSTALL_FAILED if the installation | 142 // Attempts to install an extension. Use INSTALL_FAILED if the installation |
130 // is expected to fail. | 143 // is expected to fail. |
131 // If |install_state| is INSTALL_UPDATED, and |expected_old_name| is | 144 // If |install_state| is INSTALL_UPDATED, and |expected_old_name| is |
132 // non-empty, expects that the existing extension's title was | 145 // non-empty, expects that the existing extension's title was |
133 // |expected_old_name|. | 146 // |expected_old_name|. |
134 const Extension* ExtensionServiceTestWithInstall::InstallCRX( | 147 const Extension* ExtensionServiceTestWithInstall::InstallCRX( |
135 const base::FilePath& path, | 148 const base::FilePath& path, |
136 InstallState install_state, | 149 InstallState install_state, |
137 int creation_flags, | 150 int creation_flags, |
138 const std::string& expected_old_name) { | 151 const std::string& expected_old_name) { |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
422 content::WindowedNotificationObserver observer( | 435 content::WindowedNotificationObserver observer( |
423 extensions::NOTIFICATION_CRX_INSTALLER_DONE, | 436 extensions::NOTIFICATION_CRX_INSTALLER_DONE, |
424 content::Source<extensions::CrxInstaller>(installer.get())); | 437 content::Source<extensions::CrxInstaller>(installer.get())); |
425 | 438 |
426 installer->InstallCrx(crx_path); | 439 installer->InstallCrx(crx_path); |
427 | 440 |
428 observer.Wait(); | 441 observer.Wait(); |
429 } | 442 } |
430 | 443 |
431 } // namespace extensions | 444 } // namespace extensions |
OLD | NEW |