Chromium Code Reviews| Index: chrome/browser/download/download_crx_util.cc |
| diff --git a/chrome/browser/download/download_crx_util.cc b/chrome/browser/download/download_crx_util.cc |
| index 13fd68e000ec1481d208544447980011e902522e..a7fa2a7a5f74924156d2c03d3157ce2cf18fa9e6 100644 |
| --- a/chrome/browser/download/download_crx_util.cc |
| +++ b/chrome/browser/download/download_crx_util.cc |
| @@ -27,6 +27,8 @@ namespace download_crx_util { |
| namespace { |
| +bool g_allow_offstore_install_for_testing = false; |
| + |
| // Hold a mock ExtensionInstallPrompt object that will be used when the |
| // download system opens a CRX. |
| ExtensionInstallPrompt* mock_install_prompt_for_testing = NULL; |
| @@ -131,8 +133,15 @@ bool OffStoreInstallAllowedByPrefs(Profile* profile, const DownloadItem& item) { |
| // TODO(aa): RefererURL is cleared in some cases, for example when going |
| // between secure and non-secure URLs. It would be better if DownloadItem |
| // tracked the initiating page explicitly. |
| - return extensions::ExtensionManagementFactory::GetForBrowserContext(profile) |
| - ->IsOffstoreInstallAllowed(item.GetURL(), item.GetReferrerUrl()); |
| + return g_allow_offstore_install_for_testing || |
|
Devlin
2017/02/01 17:17:42
pastarmovj@: I'd rather just have tests set the pr
Devlin
2017/02/06 17:22:33
Since this is still better than the current comple
pastarmovj
2017/02/07 06:49:06
Hey sorry I somehow missed this request. You can c
|
| + extensions::ExtensionManagementFactory::GetForBrowserContext(profile) |
| + ->IsOffstoreInstallAllowed(item.GetURL(), item.GetReferrerUrl()); |
| +} |
| + |
| +std::unique_ptr<base::AutoReset<bool>> OverrideOffstoreInstallAllowedForTesting( |
| + bool allowed) { |
| + return base::MakeUnique<base::AutoReset<bool>>( |
| + &g_allow_offstore_install_for_testing, allowed); |
| } |
| } // namespace download_crx_util |