Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: chrome/browser/extensions/extension_service_unittest.cc

Issue 2257113002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/extensions/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 5963 matching lines...) Expand 10 before | Expand all | Expand 10 after
5974 const bool kDontInstallImmediately = false; 5974 const bool kDontInstallImmediately = false;
5975 5975
5976 InitializeEmptyExtensionService(); 5976 InitializeEmptyExtensionService();
5977 5977
5978 extensions::PendingExtensionManager* pending = 5978 extensions::PendingExtensionManager* pending =
5979 service()->pending_extension_manager(); 5979 service()->pending_extension_manager();
5980 EXPECT_FALSE(pending->IsIdPending(kGoodId)); 5980 EXPECT_FALSE(pending->IsIdPending(kGoodId));
5981 5981
5982 // An external provider starts installing from a local crx. 5982 // An external provider starts installing from a local crx.
5983 std::unique_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile( 5983 std::unique_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile(
5984 kGoodId, base::WrapUnique(new Version(kVersion123)), kInvalidPathToCrx, 5984 kGoodId, base::MakeUnique<Version>(kVersion123), kInvalidPathToCrx,
5985 Manifest::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged, 5985 Manifest::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged,
5986 kDontInstallImmediately)); 5986 kDontInstallImmediately));
5987 EXPECT_TRUE(service()->OnExternalExtensionFileFound(*info)); 5987 EXPECT_TRUE(service()->OnExternalExtensionFileFound(*info));
5988 5988
5989 const extensions::PendingExtensionInfo* pending_info; 5989 const extensions::PendingExtensionInfo* pending_info;
5990 EXPECT_TRUE((pending_info = pending->GetById(kGoodId))); 5990 EXPECT_TRUE((pending_info = pending->GetById(kGoodId)));
5991 EXPECT_TRUE(pending_info->version().IsValid()); 5991 EXPECT_TRUE(pending_info->version().IsValid());
5992 EXPECT_EQ(pending_info->version(), kVersion123); 5992 EXPECT_EQ(pending_info->version(), kVersion123);
5993 5993
5994 // Adding a newer version overrides the currently pending version. 5994 // Adding a newer version overrides the currently pending version.
(...skipping 15 matching lines...) Expand all
6010 info->crx_location = Manifest::EXTERNAL_REGISTRY; 6010 info->crx_location = Manifest::EXTERNAL_REGISTRY;
6011 EXPECT_FALSE(service()->OnExternalExtensionFileFound(*info)); 6011 EXPECT_FALSE(service()->OnExternalExtensionFileFound(*info));
6012 EXPECT_TRUE((pending_info = pending->GetById(kGoodId))); 6012 EXPECT_TRUE((pending_info = pending->GetById(kGoodId)));
6013 EXPECT_TRUE(pending_info->version().IsValid()); 6013 EXPECT_TRUE(pending_info->version().IsValid());
6014 EXPECT_EQ(pending_info->version(), kVersion124); 6014 EXPECT_EQ(pending_info->version(), kVersion124);
6015 6015
6016 // Adding the latest version from the webstore overrides a specific version. 6016 // Adding the latest version from the webstore overrides a specific version.
6017 GURL kUpdateUrl("http://example.com/update"); 6017 GURL kUpdateUrl("http://example.com/update");
6018 std::unique_ptr<ExternalInstallInfoUpdateUrl> update_info( 6018 std::unique_ptr<ExternalInstallInfoUpdateUrl> update_info(
6019 new ExternalInstallInfoUpdateUrl( 6019 new ExternalInstallInfoUpdateUrl(
6020 kGoodId, std::string(), base::WrapUnique(new GURL(kUpdateUrl)), 6020 kGoodId, std::string(), base::MakeUnique<GURL>(kUpdateUrl),
6021 Manifest::EXTERNAL_POLICY_DOWNLOAD, Extension::NO_FLAGS, false)); 6021 Manifest::EXTERNAL_POLICY_DOWNLOAD, Extension::NO_FLAGS, false));
6022 EXPECT_TRUE(service()->OnExternalExtensionUpdateUrlFound(*update_info, true)); 6022 EXPECT_TRUE(service()->OnExternalExtensionUpdateUrlFound(*update_info, true));
6023 EXPECT_TRUE((pending_info = pending->GetById(kGoodId))); 6023 EXPECT_TRUE((pending_info = pending->GetById(kGoodId)));
6024 EXPECT_FALSE(pending_info->version().IsValid()); 6024 EXPECT_FALSE(pending_info->version().IsValid());
6025 } 6025 }
6026 6026
6027 // This makes sure we can package and install CRX files that use whitelisted 6027 // This makes sure we can package and install CRX files that use whitelisted
6028 // permissions. 6028 // permissions.
6029 TEST_F(ExtensionServiceTest, InstallWhitelistedExtension) { 6029 TEST_F(ExtensionServiceTest, InstallWhitelistedExtension) {
6030 std::string test_id = "hdkklepkcpckhnpgjnmbdfhehckloojk"; 6030 std::string test_id = "hdkklepkcpckhnpgjnmbdfhehckloojk";
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
6910 6910
6911 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, 6911 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED,
6912 content::Source<Profile>(profile()), 6912 content::Source<Profile>(profile()),
6913 content::NotificationService::NoDetails()); 6913 content::NotificationService::NoDetails());
6914 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); 6914 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_);
6915 EXPECT_EQ(0u, registry()->enabled_extensions().size()); 6915 EXPECT_EQ(0u, registry()->enabled_extensions().size());
6916 EXPECT_EQ(0u, registry()->disabled_extensions().size()); 6916 EXPECT_EQ(0u, registry()->disabled_extensions().size());
6917 EXPECT_EQ(0u, registry()->terminated_extensions().size()); 6917 EXPECT_EQ(0u, registry()->terminated_extensions().size());
6918 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); 6918 EXPECT_EQ(0u, registry()->blacklisted_extensions().size());
6919 } 6919 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698