Index: extensions/browser/updater/extension_downloader.cc |
diff --git a/extensions/browser/updater/extension_downloader.cc b/extensions/browser/updater/extension_downloader.cc |
index 116ef7abb1561000f78029f313f49510d8e086ab..6d94e8697669dd7efce8de52c0c1ae94a6359cf8 100644 |
--- a/extensions/browser/updater/extension_downloader.cc |
+++ b/extensions/browser/updater/extension_downloader.cc |
@@ -27,6 +27,7 @@ |
#include "extensions/browser/extensions_browser_client.h" |
#include "extensions/browser/notification_types.h" |
#include "extensions/browser/updater/extension_cache.h" |
+#include "extensions/browser/updater/extension_downloader_test_delegate.h" |
#include "extensions/browser/updater/request_queue_impl.h" |
#include "extensions/browser/updater/safe_manifest_parser.h" |
#include "extensions/common/extension_urls.h" |
@@ -90,6 +91,8 @@ const char kTokenServiceConsumerId[] = "extension_downloader"; |
const char kWebstoreOAuth2Scope[] = |
"https://www.googleapis.com/auth/chromewebstore.readonly"; |
+ExtensionDownloaderTestDelegate* g_test_delegate = nullptr; |
+ |
#define RETRY_HISTOGRAM(name, retry_count, url) \ |
if ((url).DomainIs(kGoogleDotCom)) { \ |
UMA_HISTOGRAM_CUSTOM_COUNTS("Extensions." name "RetryCountGoogleUrl", \ |
@@ -278,6 +281,12 @@ void ExtensionDownloader::SetWebstoreIdentityProvider( |
identity_provider_.swap(identity_provider); |
} |
+// static |
+void ExtensionDownloader::set_test_delegate( |
+ ExtensionDownloaderTestDelegate* delegate) { |
+ g_test_delegate = delegate; |
+} |
+ |
bool ExtensionDownloader::AddExtensionData(const std::string& id, |
const Version& version, |
Manifest::Type extension_type, |
@@ -405,6 +414,11 @@ void ExtensionDownloader::ReportStats() const { |
void ExtensionDownloader::StartUpdateCheck( |
scoped_ptr<ManifestFetchData> fetch_data) { |
+ if (g_test_delegate) { |
+ g_test_delegate->StartUpdateCheck(this, delegate_, std::move(fetch_data)); |
+ return; |
+ } |
+ |
const std::set<std::string>& id_set(fetch_data->extension_ids()); |
if (!ExtensionsBrowserClient::Get()->IsBackgroundUpdateAllowed()) { |