| Index: chrome/browser/extensions/updater/extension_updater_unittest.cc
|
| diff --git a/chrome/browser/extensions/updater/extension_updater_unittest.cc b/chrome/browser/extensions/updater/extension_updater_unittest.cc
|
| index 86ee9cc13b3a0de1ff6c3576fd23438cb1c6546d..b24e06e9a332b55508e3a619b3a69af79889552a 100644
|
| --- a/chrome/browser/extensions/updater/extension_updater_unittest.cc
|
| +++ b/chrome/browser/extensions/updater/extension_updater_unittest.cc
|
| @@ -6,8 +6,10 @@
|
|
|
| #include <stddef.h>
|
| #include <stdint.h>
|
| +
|
| #include <list>
|
| #include <map>
|
| +#include <memory>
|
| #include <set>
|
| #include <utility>
|
| #include <vector>
|
| @@ -17,7 +19,6 @@
|
| #include "base/command_line.h"
|
| #include "base/compiler_specific.h"
|
| #include "base/macros.h"
|
| -#include "base/memory/scoped_ptr.h"
|
| #include "base/memory/weak_ptr.h"
|
| #include "base/message_loop/message_loop.h"
|
| #include "base/run_loop.h"
|
| @@ -373,34 +374,34 @@ class MockService : public TestExtensionService {
|
| PendingExtensionManager pending_extension_manager_;
|
|
|
| private:
|
| - scoped_ptr<ExtensionDownloader> CreateExtensionDownloader(
|
| + std::unique_ptr<ExtensionDownloader> CreateExtensionDownloader(
|
| ExtensionDownloaderDelegate* delegate) {
|
| - scoped_ptr<ExtensionDownloader> downloader =
|
| + std::unique_ptr<ExtensionDownloader> downloader =
|
| ChromeExtensionDownloaderFactory::CreateForRequestContext(
|
| - request_context(),
|
| - downloader_delegate_override_ ? downloader_delegate_override_
|
| - : delegate);
|
| + request_context(), downloader_delegate_override_
|
| + ? downloader_delegate_override_
|
| + : delegate);
|
| if (enable_metrics_)
|
| downloader->set_enable_extra_update_metrics(true);
|
| return downloader;
|
| }
|
|
|
| - scoped_ptr<ExtensionDownloader> CreateExtensionDownloaderWithIdentity(
|
| + std::unique_ptr<ExtensionDownloader> CreateExtensionDownloaderWithIdentity(
|
| ExtensionDownloaderDelegate* delegate) {
|
| - scoped_ptr<FakeIdentityProvider> fake_identity_provider;
|
| + std::unique_ptr<FakeIdentityProvider> fake_identity_provider;
|
| fake_token_service_.reset(new FakeOAuth2TokenService());
|
| fake_identity_provider.reset(new FakeIdentityProvider(
|
| fake_token_service_.get()));
|
| fake_identity_provider->LogIn(kFakeAccountId);
|
| fake_token_service_->AddAccount(kFakeAccountId);
|
|
|
| - scoped_ptr<ExtensionDownloader> downloader(
|
| + std::unique_ptr<ExtensionDownloader> downloader(
|
| CreateExtensionDownloader(delegate));
|
| downloader->SetWebstoreIdentityProvider(std::move(fake_identity_provider));
|
| return downloader;
|
| }
|
|
|
| - scoped_ptr<FakeOAuth2TokenService> fake_token_service_;
|
| + std::unique_ptr<FakeOAuth2TokenService> fake_token_service_;
|
|
|
| ExtensionDownloaderDelegate* downloader_delegate_override_;
|
|
|
| @@ -694,7 +695,8 @@ class ExtensionUpdaterTest : public testing::Test {
|
|
|
| void StartUpdateCheck(ExtensionDownloader* downloader,
|
| ManifestFetchData* fetch_data) {
|
| - downloader->StartUpdateCheck(scoped_ptr<ManifestFetchData>(fetch_data));
|
| + downloader->StartUpdateCheck(
|
| + std::unique_ptr<ManifestFetchData>(fetch_data));
|
| }
|
|
|
| size_t ManifestFetchersCount(ExtensionDownloader* downloader) {
|
| @@ -766,7 +768,7 @@ class ExtensionUpdaterTest : public testing::Test {
|
|
|
| // Make sure that an empty update URL data string does not cause a ap=
|
| // option to appear in the x= parameter.
|
| - scoped_ptr<ManifestFetchData> fetch_data(
|
| + std::unique_ptr<ManifestFetchData> fetch_data(
|
| CreateManifestFetchData(GURL("http://localhost/foo")));
|
| fetch_data->AddExtension(id, version, &kNeverPingedData, std::string(),
|
| std::string());
|
| @@ -784,7 +786,7 @@ class ExtensionUpdaterTest : public testing::Test {
|
|
|
| // Make sure that an update URL data string causes an appropriate ap=
|
| // option to appear in the x= parameter.
|
| - scoped_ptr<ManifestFetchData> fetch_data(
|
| + std::unique_ptr<ManifestFetchData> fetch_data(
|
| CreateManifestFetchData(GURL("http://localhost/foo")));
|
| fetch_data->AddExtension(id, version, &kNeverPingedData, "bar",
|
| std::string());
|
| @@ -801,7 +803,7 @@ class ExtensionUpdaterTest : public testing::Test {
|
|
|
| // Make sure that an update URL data string causes an appropriate ap=
|
| // option to appear in the x= parameter.
|
| - scoped_ptr<ManifestFetchData> fetch_data(
|
| + std::unique_ptr<ManifestFetchData> fetch_data(
|
| CreateManifestFetchData(GURL("http://localhost/foo")));
|
| fetch_data->AddExtension(id, version, &kNeverPingedData, "a=1&b=2&c",
|
| std::string());
|
| @@ -846,7 +848,7 @@ class ExtensionUpdaterTest : public testing::Test {
|
| const std::string install_source = "instally";
|
|
|
| // Make sure that an installsource= appears in the x= parameter.
|
| - scoped_ptr<ManifestFetchData> fetch_data(
|
| + std::unique_ptr<ManifestFetchData> fetch_data(
|
| CreateManifestFetchData(GURL("http://localhost/foo")));
|
| fetch_data->AddExtension(id, version, &kNeverPingedData,
|
| kEmptyUpdateUrlData, install_source);
|
| @@ -863,7 +865,7 @@ class ExtensionUpdaterTest : public testing::Test {
|
| ExtensionDownloader downloader(&delegate, profile.GetRequestContext());
|
|
|
| // Check passing an empty list of parse results to DetermineUpdates
|
| - scoped_ptr<ManifestFetchData> fetch_data(
|
| + std::unique_ptr<ManifestFetchData> fetch_data(
|
| CreateManifestFetchData(GURL("http://localhost/foo")));
|
| UpdateManifest::Results updates;
|
| std::vector<int> updateable;
|
| @@ -906,7 +908,7 @@ class ExtensionUpdaterTest : public testing::Test {
|
| MockExtensionDownloaderDelegate delegate;
|
| ExtensionDownloader downloader(&delegate, profile.GetRequestContext());
|
|
|
| - scoped_ptr<ManifestFetchData> fetch_data(
|
| + std::unique_ptr<ManifestFetchData> fetch_data(
|
| CreateManifestFetchData(GURL("http://localhost/foo")));
|
| UpdateManifest::Results updates;
|
|
|
| @@ -946,10 +948,14 @@ class ExtensionUpdaterTest : public testing::Test {
|
|
|
| GURL kUpdateUrl("http://localhost/manifest1");
|
|
|
| - scoped_ptr<ManifestFetchData> fetch1(CreateManifestFetchData(kUpdateUrl));
|
| - scoped_ptr<ManifestFetchData> fetch2(CreateManifestFetchData(kUpdateUrl));
|
| - scoped_ptr<ManifestFetchData> fetch3(CreateManifestFetchData(kUpdateUrl));
|
| - scoped_ptr<ManifestFetchData> fetch4(CreateManifestFetchData(kUpdateUrl));
|
| + std::unique_ptr<ManifestFetchData> fetch1(
|
| + CreateManifestFetchData(kUpdateUrl));
|
| + std::unique_ptr<ManifestFetchData> fetch2(
|
| + CreateManifestFetchData(kUpdateUrl));
|
| + std::unique_ptr<ManifestFetchData> fetch3(
|
| + CreateManifestFetchData(kUpdateUrl));
|
| + std::unique_ptr<ManifestFetchData> fetch4(
|
| + CreateManifestFetchData(kUpdateUrl));
|
| ManifestFetchData::PingData zeroDays(0, 0, true, 0);
|
| fetch1->AddExtension("1111", "1.0", &zeroDays, kEmptyUpdateUrlData,
|
| std::string());
|
| @@ -1086,7 +1092,8 @@ class ExtensionUpdaterTest : public testing::Test {
|
|
|
| GURL kUpdateUrl("http://localhost/manifest1");
|
|
|
| - scoped_ptr<ManifestFetchData> fetch(CreateManifestFetchData(kUpdateUrl));
|
| + std::unique_ptr<ManifestFetchData> fetch(
|
| + CreateManifestFetchData(kUpdateUrl));
|
| ManifestFetchData::PingData zeroDays(0, 0, true, 0);
|
| fetch->AddExtension("1111", "1.0", &zeroDays, kEmptyUpdateUrlData,
|
| std::string());
|
| @@ -1152,7 +1159,7 @@ class ExtensionUpdaterTest : public testing::Test {
|
| void TestSingleExtensionDownloading(bool pending, bool retry, bool fail) {
|
| net::TestURLFetcherFactory factory;
|
| net::TestURLFetcher* fetcher = NULL;
|
| - scoped_ptr<ServiceForDownloadTests> service(
|
| + std::unique_ptr<ServiceForDownloadTests> service(
|
| new ServiceForDownloadTests(prefs_.get()));
|
| ExtensionUpdater updater(service.get(),
|
| service->extension_prefs(),
|
| @@ -1176,9 +1183,9 @@ class ExtensionUpdaterTest : public testing::Test {
|
| Version version("0.0.1");
|
| std::set<int> requests;
|
| requests.insert(0);
|
| - scoped_ptr<ExtensionDownloader::ExtensionFetch> fetch(
|
| - new ExtensionDownloader::ExtensionFetch(
|
| - id, test_url, hash, version.GetString(), requests));
|
| + std::unique_ptr<ExtensionDownloader::ExtensionFetch> fetch(
|
| + new ExtensionDownloader::ExtensionFetch(id, test_url, hash,
|
| + version.GetString(), requests));
|
| updater.downloader_->FetchUpdatedExtension(std::move(fetch));
|
|
|
| if (pending) {
|
| @@ -1262,7 +1269,7 @@ class ExtensionUpdaterTest : public testing::Test {
|
| int max_authuser) {
|
| net::TestURLFetcherFactory factory;
|
| net::TestURLFetcher* fetcher = NULL;
|
| - scoped_ptr<ServiceForDownloadTests> service(
|
| + std::unique_ptr<ServiceForDownloadTests> service(
|
| new ServiceForDownloadTests(prefs_.get()));
|
| const ExtensionDownloader::Factory& downloader_factory =
|
| enable_oauth2 ? service->GetAuthenticatedDownloaderFactory()
|
| @@ -1286,9 +1293,9 @@ class ExtensionUpdaterTest : public testing::Test {
|
| Version version("0.0.1");
|
| std::set<int> requests;
|
| requests.insert(0);
|
| - scoped_ptr<ExtensionDownloader::ExtensionFetch> fetch(
|
| - new ExtensionDownloader::ExtensionFetch(
|
| - id, test_url, hash, version.GetString(), requests));
|
| + std::unique_ptr<ExtensionDownloader::ExtensionFetch> fetch(
|
| + new ExtensionDownloader::ExtensionFetch(id, test_url, hash,
|
| + version.GetString(), requests));
|
| updater.downloader_->FetchUpdatedExtension(std::move(fetch));
|
|
|
| fetcher = factory.GetFetcherByID(ExtensionDownloader::kExtensionFetcherId);
|
| @@ -1476,12 +1483,12 @@ class ExtensionUpdaterTest : public testing::Test {
|
| std::set<int> requests;
|
| requests.insert(0);
|
| // Start two fetches
|
| - scoped_ptr<ExtensionDownloader::ExtensionFetch> fetch1(
|
| - new ExtensionDownloader::ExtensionFetch(
|
| - id1, url1, hash1, version1, requests));
|
| - scoped_ptr<ExtensionDownloader::ExtensionFetch> fetch2(
|
| - new ExtensionDownloader::ExtensionFetch(
|
| - id2, url2, hash2, version2, requests));
|
| + std::unique_ptr<ExtensionDownloader::ExtensionFetch> fetch1(
|
| + new ExtensionDownloader::ExtensionFetch(id1, url1, hash1, version1,
|
| + requests));
|
| + std::unique_ptr<ExtensionDownloader::ExtensionFetch> fetch2(
|
| + new ExtensionDownloader::ExtensionFetch(id2, url2, hash2, version2,
|
| + requests));
|
| updater.downloader_->FetchUpdatedExtension(std::move(fetch1));
|
| updater.downloader_->FetchUpdatedExtension(std::move(fetch2));
|
|
|
| @@ -1775,7 +1782,7 @@ class ExtensionUpdaterTest : public testing::Test {
|
| updater.Start();
|
| updater.EnsureDownloaderCreated();
|
|
|
| - scoped_ptr<ManifestFetchData> fetch_data(
|
| + std::unique_ptr<ManifestFetchData> fetch_data(
|
| CreateManifestFetchData(update_url));
|
| const Extension* extension = tmp[0].get();
|
| fetch_data->AddExtension(extension->id(), extension->VersionString(),
|
| @@ -1888,7 +1895,7 @@ class ExtensionUpdaterTest : public testing::Test {
|
| }
|
|
|
| protected:
|
| - scoped_ptr<TestExtensionPrefs> prefs_;
|
| + std::unique_ptr<TestExtensionPrefs> prefs_;
|
|
|
| ManifestFetchData* CreateManifestFetchData(const GURL& update_url) {
|
| return new ManifestFetchData(update_url, 0, "",
|
| @@ -2124,7 +2131,7 @@ TEST_F(ExtensionUpdaterTest, TestManifestFetchesBuilderAddExtension) {
|
| net::TestURLFetcherFactory factory;
|
| MockService service(prefs_.get());
|
| MockExtensionDownloaderDelegate delegate;
|
| - scoped_ptr<ExtensionDownloader> downloader(
|
| + std::unique_ptr<ExtensionDownloader> downloader(
|
| new ExtensionDownloader(&delegate, service.request_context()));
|
| EXPECT_EQ(0u, ManifestFetchersCount(downloader.get()));
|
|
|
|
|