| OLD | NEW |
| 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 "chrome/browser/chrome_notification_types.h" | 5 #include "chrome/browser/chrome_notification_types.h" |
| 6 #include "chrome/browser/extensions/crx_installer.h" | 6 #include "chrome/browser/extensions/crx_installer.h" |
| 7 #include "chrome/browser/extensions/extension_browsertest.h" | 7 #include "chrome/browser/extensions/extension_browsertest.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/extensions/extension_util.h" | 9 #include "chrome/browser/extensions/extension_util.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 base::FilePath path = test_data_dir_.AppendASCII(filename); | 24 base::FilePath path = test_data_dir_.AppendASCII(filename); |
| 25 | 25 |
| 26 content::WindowedNotificationObserver extension_loaded_observer( | 26 content::WindowedNotificationObserver extension_loaded_observer( |
| 27 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, | 27 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 28 content::NotificationService::AllSources()); | 28 content::NotificationService::AllSources()); |
| 29 | 29 |
| 30 scoped_refptr<extensions::CrxInstaller> installer( | 30 scoped_refptr<extensions::CrxInstaller> installer( |
| 31 extensions::CrxInstaller::CreateSilent(service)); | 31 extensions::CrxInstaller::CreateSilent(service)); |
| 32 installer->set_is_gallery_install(false); | 32 installer->set_is_gallery_install(false); |
| 33 installer->set_allow_silent_install(true); | 33 installer->set_allow_silent_install( |
| 34 extensions::CrxInstaller::GRANT_SILENTLY); |
| 34 installer->set_install_source(Manifest::INTERNAL); | 35 installer->set_install_source(Manifest::INTERNAL); |
| 35 installer->set_off_store_install_allow_reason( | 36 installer->set_off_store_install_allow_reason( |
| 36 extensions::CrxInstaller::OffStoreInstallAllowedInTest); | 37 extensions::CrxInstaller::OffStoreInstallAllowedInTest); |
| 37 | 38 |
| 38 observer_->Watch( | 39 observer_->Watch( |
| 39 chrome::NOTIFICATION_CRX_INSTALLER_DONE, | 40 chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
| 40 content::Source<extensions::CrxInstaller>(installer.get())); | 41 content::Source<extensions::CrxInstaller>(installer.get())); |
| 41 | 42 |
| 42 installer->InstallCrx(path); | 43 installer->InstallCrx(path); |
| 43 observer_->Wait(); | 44 observer_->Wait(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 service->EnableExtension(last_loaded_extension_id()); | 86 service->EnableExtension(last_loaded_extension_id()); |
| 86 util::SetIsIncognitoEnabled(last_loaded_extension_id(), profile(), true); | 87 util::SetIsIncognitoEnabled(last_loaded_extension_id(), profile(), true); |
| 87 EXPECT_TRUE(util::IsIncognitoEnabled(last_loaded_extension_id(), profile())); | 88 EXPECT_TRUE(util::IsIncognitoEnabled(last_loaded_extension_id(), profile())); |
| 88 | 89 |
| 89 // Disallow extension in incognito mode and verify. | 90 // Disallow extension in incognito mode and verify. |
| 90 service->EnableExtension(last_loaded_extension_id()); | 91 service->EnableExtension(last_loaded_extension_id()); |
| 91 util::SetIsIncognitoEnabled(last_loaded_extension_id(), profile(), false); | 92 util::SetIsIncognitoEnabled(last_loaded_extension_id(), profile(), false); |
| 92 EXPECT_FALSE(util::IsIncognitoEnabled(last_loaded_extension_id(), profile())); | 93 EXPECT_FALSE(util::IsIncognitoEnabled(last_loaded_extension_id(), profile())); |
| 93 } | 94 } |
| 94 } // namespace extensions | 95 } // namespace extensions |
| OLD | NEW |