Chromium Code Reviews| Index: chrome/browser/extensions/extension_browsertest.cc |
| diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc |
| index ca5053ca75fa125c8c68c6210ad5d22a1da94ed7..a2c341ddfff13573601a1ae05894449f8d533714 100644 |
| --- a/chrome/browser/extensions/extension_browsertest.cc |
| +++ b/chrome/browser/extensions/extension_browsertest.cc |
| @@ -124,8 +124,27 @@ void ExtensionBrowserTest::SetUpOnMainThread() { |
| observer_.reset(new ExtensionTestNotificationObserver(browser())); |
| } |
| +const Extension* ExtensionBrowserTest::LoadExtension( |
| + const base::FilePath& path) { |
| + return LoadExtensionWithFlags(path, kFlagEnableFileAccess); |
| +} |
| + |
| +const Extension* ExtensionBrowserTest::LoadExtensionIncognito( |
| + const base::FilePath& path) { |
| + return LoadExtensionWithFlags(path, |
| + kFlagEnableFileAccess | kFlagEnableIncognito); |
| +} |
| + |
| const Extension* ExtensionBrowserTest::LoadExtensionWithFlags( |
| const base::FilePath& path, int flags) { |
| + return LoadExtensionWithInstallParam(path, flags, std::string()); |
| +} |
| + |
| +const extensions::Extension* |
| +ExtensionBrowserTest::LoadExtensionWithInstallParam( |
| + const base::FilePath& path, |
| + int flags, |
| + const std::string& install_param) { |
| ExtensionService* service = extensions::ExtensionSystem::Get( |
| profile())->extension_service(); |
| { |
| @@ -167,15 +186,22 @@ const Extension* ExtensionBrowserTest::LoadExtensionWithFlags( |
| } |
| } |
| - const std::string extension_id = extension->id(); |
| - |
| - // The call to OnExtensionInstalled ensures the other extension prefs |
| - // are set up with the defaults. |
| - extensions::ExtensionPrefs::Get(profile()) |
| - ->OnExtensionInstalled(extension, |
| - Extension::ENABLED, |
| - false, |
| - syncer::StringOrdinal::CreateInitialOrdinal()); |
| + std::string extension_id = extension->id(); |
|
Finnur
2014/03/13 16:37:51
Out of curiosity... What necessitates the const re
vasilii
2014/03/14 10:54:58
I wanted to remove the reference here..
|
| + |
| + if (!install_param.empty()) { |
| + extensions::ExtensionPrefs::Get(profile()) |
| + ->SetInstallParam(extension_id, install_param); |
| + // Reenable the extension if needed |
|
Finnur
2014/03/13 16:37:51
nit:
s/Reenable/Re-enable/
... and end the comment
vasilii
2014/03/14 10:54:58
Done.
|
| + if (service->extensions()->Contains(extension_id)) { |
| + content::WindowedNotificationObserver load_signal( |
| + chrome::NOTIFICATION_EXTENSION_LOADED, |
| + content::Source<Profile>(profile())); |
| + service->ReloadExtension(extension_id); |
|
Finnur
2014/03/13 16:37:51
Maybe document why this is needed?
vasilii
2014/03/14 10:54:58
Done.
|
| + load_signal.Wait(); |
| + extension = service->GetExtensionById(extension_id, false); |
| + CHECK(extension) << extension_id << " not found after reloading."; |
| + } |
| + } |
| // Toggling incognito or file access will reload the extension, so wait for |
| // the reload and grab the new extension instance. The default state is |
| @@ -214,17 +240,6 @@ const Extension* ExtensionBrowserTest::LoadExtensionWithFlags( |
| return extension; |
| } |
| -const Extension* ExtensionBrowserTest::LoadExtension( |
| - const base::FilePath& path) { |
| - return LoadExtensionWithFlags(path, kFlagEnableFileAccess); |
| -} |
| - |
| -const Extension* ExtensionBrowserTest::LoadExtensionIncognito( |
| - const base::FilePath& path) { |
| - return LoadExtensionWithFlags(path, |
| - kFlagEnableFileAccess | kFlagEnableIncognito); |
| -} |
| - |
| const Extension* ExtensionBrowserTest::LoadExtensionAsComponentWithManifest( |
| const base::FilePath& path, |
| const base::FilePath::CharType* manifest_relative_path) { |