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

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: Rebase Created 4 years, 3 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 5965 matching lines...) Expand 10 before | Expand all | Expand 10 after
5976 const bool kDontInstallImmediately = false; 5976 const bool kDontInstallImmediately = false;
5977 5977
5978 InitializeEmptyExtensionService(); 5978 InitializeEmptyExtensionService();
5979 5979
5980 extensions::PendingExtensionManager* pending = 5980 extensions::PendingExtensionManager* pending =
5981 service()->pending_extension_manager(); 5981 service()->pending_extension_manager();
5982 EXPECT_FALSE(pending->IsIdPending(kGoodId)); 5982 EXPECT_FALSE(pending->IsIdPending(kGoodId));
5983 5983
5984 // An external provider starts installing from a local crx. 5984 // An external provider starts installing from a local crx.
5985 std::unique_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile( 5985 std::unique_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile(
5986 kGoodId, base::WrapUnique(new base::Version(kVersion123)), 5986 kGoodId, base::MakeUnique<base::Version>(kVersion123),
5987 kInvalidPathToCrx, Manifest::EXTERNAL_PREF, kCreationFlags, 5987 kInvalidPathToCrx, Manifest::EXTERNAL_PREF, kCreationFlags,
5988 kDontMarkAcknowledged, kDontInstallImmediately)); 5988 kDontMarkAcknowledged, kDontInstallImmediately));
5989 EXPECT_TRUE(service()->OnExternalExtensionFileFound(*info)); 5989 EXPECT_TRUE(service()->OnExternalExtensionFileFound(*info));
5990 5990
5991 const extensions::PendingExtensionInfo* pending_info; 5991 const extensions::PendingExtensionInfo* pending_info;
5992 EXPECT_TRUE((pending_info = pending->GetById(kGoodId))); 5992 EXPECT_TRUE((pending_info = pending->GetById(kGoodId)));
5993 EXPECT_TRUE(pending_info->version().IsValid()); 5993 EXPECT_TRUE(pending_info->version().IsValid());
5994 EXPECT_EQ(pending_info->version(), kVersion123); 5994 EXPECT_EQ(pending_info->version(), kVersion123);
5995 5995
5996 // Adding a newer version overrides the currently pending version. 5996 // Adding a newer version overrides the currently pending version.
(...skipping 15 matching lines...) Expand all
6012 info->crx_location = Manifest::EXTERNAL_REGISTRY; 6012 info->crx_location = Manifest::EXTERNAL_REGISTRY;
6013 EXPECT_FALSE(service()->OnExternalExtensionFileFound(*info)); 6013 EXPECT_FALSE(service()->OnExternalExtensionFileFound(*info));
6014 EXPECT_TRUE((pending_info = pending->GetById(kGoodId))); 6014 EXPECT_TRUE((pending_info = pending->GetById(kGoodId)));
6015 EXPECT_TRUE(pending_info->version().IsValid()); 6015 EXPECT_TRUE(pending_info->version().IsValid());
6016 EXPECT_EQ(pending_info->version(), kVersion124); 6016 EXPECT_EQ(pending_info->version(), kVersion124);
6017 6017
6018 // Adding the latest version from the webstore overrides a specific version. 6018 // Adding the latest version from the webstore overrides a specific version.
6019 GURL kUpdateUrl("http://example.com/update"); 6019 GURL kUpdateUrl("http://example.com/update");
6020 std::unique_ptr<ExternalInstallInfoUpdateUrl> update_info( 6020 std::unique_ptr<ExternalInstallInfoUpdateUrl> update_info(
6021 new ExternalInstallInfoUpdateUrl( 6021 new ExternalInstallInfoUpdateUrl(
6022 kGoodId, std::string(), base::WrapUnique(new GURL(kUpdateUrl)), 6022 kGoodId, std::string(), base::MakeUnique<GURL>(kUpdateUrl),
6023 Manifest::EXTERNAL_POLICY_DOWNLOAD, Extension::NO_FLAGS, false)); 6023 Manifest::EXTERNAL_POLICY_DOWNLOAD, Extension::NO_FLAGS, false));
6024 EXPECT_TRUE(service()->OnExternalExtensionUpdateUrlFound(*update_info, true)); 6024 EXPECT_TRUE(service()->OnExternalExtensionUpdateUrlFound(*update_info, true));
6025 EXPECT_TRUE((pending_info = pending->GetById(kGoodId))); 6025 EXPECT_TRUE((pending_info = pending->GetById(kGoodId)));
6026 EXPECT_FALSE(pending_info->version().IsValid()); 6026 EXPECT_FALSE(pending_info->version().IsValid());
6027 } 6027 }
6028 6028
6029 // This makes sure we can package and install CRX files that use whitelisted 6029 // This makes sure we can package and install CRX files that use whitelisted
6030 // permissions. 6030 // permissions.
6031 TEST_F(ExtensionServiceTest, InstallWhitelistedExtension) { 6031 TEST_F(ExtensionServiceTest, InstallWhitelistedExtension) {
6032 std::string test_id = "hdkklepkcpckhnpgjnmbdfhehckloojk"; 6032 std::string test_id = "hdkklepkcpckhnpgjnmbdfhehckloojk";
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
6912 6912
6913 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, 6913 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED,
6914 content::Source<Profile>(profile()), 6914 content::Source<Profile>(profile()),
6915 content::NotificationService::NoDetails()); 6915 content::NotificationService::NoDetails());
6916 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); 6916 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_);
6917 EXPECT_EQ(0u, registry()->enabled_extensions().size()); 6917 EXPECT_EQ(0u, registry()->enabled_extensions().size());
6918 EXPECT_EQ(0u, registry()->disabled_extensions().size()); 6918 EXPECT_EQ(0u, registry()->disabled_extensions().size());
6919 EXPECT_EQ(0u, registry()->terminated_extensions().size()); 6919 EXPECT_EQ(0u, registry()->terminated_extensions().size());
6920 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); 6920 EXPECT_EQ(0u, registry()->blacklisted_extensions().size());
6921 } 6921 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service_sync_unittest.cc ('k') | chrome/browser/extensions/extension_web_ui_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698