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

Unified Diff: chrome/installer/setup/install_worker_unittest.cc

Issue 1878313003: Convert //chrome/installer from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert decompress.cc in mini_installer. Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/installer/setup/install_worker.cc ('k') | chrome/installer/setup/installer_crash_reporter_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/setup/install_worker_unittest.cc
diff --git a/chrome/installer/setup/install_worker_unittest.cc b/chrome/installer/setup/install_worker_unittest.cc
index b8c0fc4dbd89d224f55ad80d95a4bb4c2856b492..8907a53abffcb5226aee5ff9258720f9b8adab8a 100644
--- a/chrome/installer/setup/install_worker_unittest.cc
+++ b/chrome/installer/setup/install_worker_unittest.cc
@@ -301,7 +301,7 @@ class InstallWorkerTest : public testing::Test {
MockInstallationState* BuildChromeInstallationState(bool system_level,
bool multi_install) {
- scoped_ptr<MockInstallationState> installation_state(
+ std::unique_ptr<MockInstallationState> installation_state(
new MockInstallationState());
AddChromeToInstallationState(system_level, multi_install,
installation_state.get());
@@ -313,7 +313,8 @@ class InstallWorkerTest : public testing::Test {
bool multi_install,
const InstallationState& machine_state,
InstallerState::Operation operation) {
- scoped_ptr<MockInstallerState> installer_state(new MockInstallerState());
+ std::unique_ptr<MockInstallerState> installer_state(
+ new MockInstallerState());
InstallerState::Level level = system_install ?
InstallerState::SYSTEM_LEVEL : InstallerState::USER_LEVEL;
@@ -349,7 +350,7 @@ class InstallWorkerTest : public testing::Test {
BrowserDistribution* dist =
BrowserDistribution::GetSpecificDistribution(
BrowserDistribution::CHROME_BINARIES);
- scoped_ptr<Product> product(new Product(dist));
+ std::unique_ptr<Product> product(new Product(dist));
product->SetOption(installer::kOptionMultiInstall, true);
installer_state->AddProduct(&product);
}
@@ -370,7 +371,7 @@ class InstallWorkerTest : public testing::Test {
BrowserDistribution* dist =
BrowserDistribution::GetSpecificDistribution(
BrowserDistribution::CHROME_BROWSER);
- scoped_ptr<Product> product(new Product(dist));
+ std::unique_ptr<Product> product(new Product(dist));
if (installer_state->is_multi_install())
product->SetOption(installer::kOptionMultiInstall, true);
installer_state->AddProduct(&product);
@@ -391,7 +392,7 @@ class InstallWorkerTest : public testing::Test {
BrowserDistribution* dist =
BrowserDistribution::GetSpecificDistribution(
BrowserDistribution::CHROME_FRAME);
- scoped_ptr<Product> product(new Product(dist));
+ std::unique_ptr<Product> product(new Product(dist));
if (installer_state->is_multi_install())
product->SetOption(installer::kOptionMultiInstall, true);
installer_state->AddProduct(&product);
@@ -403,7 +404,7 @@ class InstallWorkerTest : public testing::Test {
bool multi_install,
const InstallationState& machine_state,
InstallerState::Operation operation) {
- scoped_ptr<MockInstallerState> installer_state(
+ std::unique_ptr<MockInstallerState> installer_state(
BuildBasicInstallerState(system_install, multi_install, machine_state,
operation));
if (multi_install) {
@@ -426,7 +427,7 @@ class InstallWorkerTest : public testing::Test {
InstallerState::Operation operation) {
// This method only works for installation/upgrade.
DCHECK(operation != InstallerState::UNINSTALL);
- scoped_ptr<MockInstallerState> installer_state(
+ std::unique_ptr<MockInstallerState> installer_state(
BuildBasicInstallerState(system_install, multi_install, machine_state,
operation));
if (multi_install)
@@ -436,8 +437,8 @@ class InstallWorkerTest : public testing::Test {
}
protected:
- scoped_ptr<Version> current_version_;
- scoped_ptr<Version> new_version_;
+ std::unique_ptr<Version> current_version_;
+ std::unique_ptr<Version> new_version_;
base::FilePath archive_path_;
base::FilePath installation_path_;
base::FilePath setup_path_;
@@ -455,26 +456,25 @@ TEST_F(InstallWorkerTest, TestInstallChromeSingleSystem) {
const HKEY kRegRoot = system_level ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
static const wchar_t kRegKeyPath[] = L"Software\\Chromium\\test";
- scoped_ptr<CreateRegKeyWorkItem> create_reg_key_work_item(
- WorkItem::CreateCreateRegKeyWorkItem(
- kRegRoot, kRegKeyPath, WorkItem::kWow64Default));
- scoped_ptr<SetRegValueWorkItem> set_reg_value_work_item(
+ std::unique_ptr<CreateRegKeyWorkItem> create_reg_key_work_item(
+ WorkItem::CreateCreateRegKeyWorkItem(kRegRoot, kRegKeyPath,
+ WorkItem::kWow64Default));
+ std::unique_ptr<SetRegValueWorkItem> set_reg_value_work_item(
WorkItem::CreateSetRegValueWorkItem(
kRegRoot, kRegKeyPath, WorkItem::kWow64Default, L"", L"", false));
- scoped_ptr<DeleteTreeWorkItem> delete_tree_work_item(
+ std::unique_ptr<DeleteTreeWorkItem> delete_tree_work_item(
WorkItem::CreateDeleteTreeWorkItem(base::FilePath(), base::FilePath(),
std::vector<base::FilePath>()));
- scoped_ptr<DeleteRegKeyWorkItem> delete_reg_key_work_item(
+ std::unique_ptr<DeleteRegKeyWorkItem> delete_reg_key_work_item(
WorkItem::CreateDeleteRegKeyWorkItem(kRegRoot, kRegKeyPath,
WorkItem::kWow64Default));
- scoped_ptr<InstallationState> installation_state(
+ std::unique_ptr<InstallationState> installation_state(
BuildChromeInstallationState(system_level, multi_install));
- scoped_ptr<InstallerState> installer_state(
- BuildChromeInstallerState(system_level, multi_install,
- *installation_state,
- InstallerState::SINGLE_INSTALL_OR_UPDATE));
+ std::unique_ptr<InstallerState> installer_state(BuildChromeInstallerState(
+ system_level, multi_install, *installation_state,
+ InstallerState::SINGLE_INSTALL_OR_UPDATE));
// Set up some expectations.
// TODO(robertshield): Set up some real expectations.
@@ -538,8 +538,8 @@ class OldIELowRightsTests : public InstallWorkerTest,
installer_state_.get());
}
- scoped_ptr<MockInstallationState> installation_state_;
- scoped_ptr<MockInstallerState> installer_state_;
+ std::unique_ptr<MockInstallationState> installation_state_;
+ std::unique_ptr<MockInstallerState> installer_state_;
bool system_level_;
bool multi_install_;
HKEY root_key_;
@@ -565,7 +565,7 @@ TEST_F(InstallWorkerTest, GoogleUpdateWorkItemsTest) {
MockWorkItemList work_item_list;
// Per-machine single-install Chrome is installed.
- scoped_ptr<MockInstallationState> installation_state(
+ std::unique_ptr<MockInstallationState> installation_state(
BuildChromeInstallationState(system_level, false));
MockProductState cf_state;
@@ -577,10 +577,9 @@ TEST_F(InstallWorkerTest, GoogleUpdateWorkItemsTest) {
BrowserDistribution::CHROME_FRAME, cf_state);
// Prepare per-machine multi-install Chrome for installation.
- scoped_ptr<MockInstallerState> installer_state(
- BuildChromeInstallerState(system_level, multi_install,
- *installation_state,
- InstallerState::MULTI_INSTALL));
+ std::unique_ptr<MockInstallerState> installer_state(BuildChromeInstallerState(
+ system_level, multi_install, *installation_state,
+ InstallerState::MULTI_INSTALL));
// Expect the multi Client State key to be created for the binaries.
#if defined(GOOGLE_CHROME_BUILD)
@@ -637,7 +636,7 @@ TEST_F(InstallWorkerTest, AddUsageStatsWorkItems) {
const bool multi_install = true;
MockWorkItemList work_item_list;
- scoped_ptr<MockInstallationState> installation_state(
+ std::unique_ptr<MockInstallationState> installation_state(
BuildChromeInstallationState(system_level, multi_install));
MockProductState chrome_state;
@@ -648,10 +647,9 @@ TEST_F(InstallWorkerTest, AddUsageStatsWorkItems) {
installation_state->SetProductState(system_level,
BrowserDistribution::CHROME_BROWSER, chrome_state);
- scoped_ptr<MockInstallerState> installer_state(
- BuildChromeInstallerState(system_level, multi_install,
- *installation_state,
- InstallerState::MULTI_INSTALL));
+ std::unique_ptr<MockInstallerState> installer_state(BuildChromeInstallerState(
+ system_level, multi_install, *installation_state,
+ InstallerState::MULTI_INSTALL));
// Expect the multi Client State key to be created.
BrowserDistribution* multi_dist =
@@ -732,8 +730,8 @@ class QuickEnableAbsentTest : public InstallWorkerTest {
static const bool system_level_ = false;
static const wchar_t kRegKeyPath[];
HKEY root_key_;
- scoped_ptr<DeleteRegKeyWorkItem> delete_reg_key_item_;
- scoped_ptr<MockInstallationState> machine_state_;
+ std::unique_ptr<DeleteRegKeyWorkItem> delete_reg_key_item_;
+ std::unique_ptr<MockInstallationState> machine_state_;
StrictMock<MockWorkItemList> work_item_list_;
};
@@ -743,9 +741,8 @@ const wchar_t QuickEnableAbsentTest::kRegKeyPath[] =
TEST_F(QuickEnableAbsentTest, CleanInstallSingleChrome) {
// Install single Chrome on a clean system.
- scoped_ptr<MockInstallerState> installer_state(
- BuildBasicInstallerState(system_level_, true, *machine_state_,
- InstallerState::MULTI_UPDATE));
+ std::unique_ptr<MockInstallerState> installer_state(BuildBasicInstallerState(
+ system_level_, true, *machine_state_, InstallerState::MULTI_UPDATE));
AddQuickEnableChromeFrameWorkItems(*installer_state, &work_item_list_);
}
@@ -773,7 +770,7 @@ TEST_F(InstallWorkerTest, WillProductBePresentAfterSetup) {
// Loop over machine states: {No product, Chrome, CF, Chrome + CF}.
for (int i_mach = 0; i_mach < (1 << NUM_TYPE); ++i_mach) {
// i_mach is the machine state before operation, as bit mask.
- scoped_ptr<MockInstallationState> machine_state(
+ std::unique_ptr<MockInstallationState> machine_state(
new MockInstallationState());
if ((i_mach & (1 << TYPE_BROWSER)) != 0) { // Add Chrome.
AddChromeToInstallationState(system_level, multi_install,
@@ -789,7 +786,7 @@ TEST_F(InstallWorkerTest, WillProductBePresentAfterSetup) {
// Loop over product types to operate on: {TYPE_BROWSER, TYPE_CF}.
for (int i_type_op = 0; i_type_op < NUM_TYPE; ++i_type_op) {
- scoped_ptr<InstallerState> installer_state;
+ std::unique_ptr<InstallerState> installer_state;
if (i_type_op == TYPE_BROWSER) {
installer_state.reset(BuildChromeInstallerState(
system_level, multi_install, *machine_state, op));
« no previous file with comments | « chrome/installer/setup/install_worker.cc ('k') | chrome/installer/setup/installer_crash_reporter_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698