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

Side by Side Diff: chrome/installer/setup/setup_util_unittest.cc

Issue 1100223002: Update {virtual,override} to follow C++11 style in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/installer/setup/setup_util_unittest.h" 5 #include "chrome/installer/setup/setup_util_unittest.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 17 matching lines...) Expand all
28 #include "chrome/installer/util/installation_state.h" 28 #include "chrome/installer/util/installation_state.h"
29 #include "chrome/installer/util/installer_state.h" 29 #include "chrome/installer/util/installer_state.h"
30 #include "chrome/installer/util/updating_app_registration_data.h" 30 #include "chrome/installer/util/updating_app_registration_data.h"
31 #include "chrome/installer/util/util_constants.h" 31 #include "chrome/installer/util/util_constants.h"
32 #include "testing/gtest/include/gtest/gtest.h" 32 #include "testing/gtest/include/gtest/gtest.h"
33 33
34 namespace { 34 namespace {
35 35
36 class SetupUtilTestWithDir : public testing::Test { 36 class SetupUtilTestWithDir : public testing::Test {
37 protected: 37 protected:
38 virtual void SetUp() override { 38 void SetUp() override {
39 // Create a temp directory for testing. 39 // Create a temp directory for testing.
40 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); 40 ASSERT_TRUE(test_dir_.CreateUniqueTempDir());
41 } 41 }
42 42
43 virtual void TearDown() override { 43 void TearDown() override {
44 // Clean up test directory manually so we can fail if it leaks. 44 // Clean up test directory manually so we can fail if it leaks.
45 ASSERT_TRUE(test_dir_.Delete()); 45 ASSERT_TRUE(test_dir_.Delete());
46 } 46 }
47 47
48 // The temporary directory used to contain the test operations. 48 // The temporary directory used to contain the test operations.
49 base::ScopedTempDir test_dir_; 49 base::ScopedTempDir test_dir_;
50 }; 50 };
51 51
52 // The privilege tested in ScopeTokenPrivilege tests below. 52 // The privilege tested in ScopeTokenPrivilege tests below.
53 // Use SE_RESTORE_NAME as it is one of the many privileges that is available, 53 // Use SE_RESTORE_NAME as it is one of the many privileges that is available,
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 version_.reset(new Version(version)); 283 version_.reset(new Version(version));
284 else 284 else
285 version_.reset(); 285 version_.reset();
286 } 286 }
287 287
288 void set_uninstall_command(const base::CommandLine& uninstall_command) { 288 void set_uninstall_command(const base::CommandLine& uninstall_command) {
289 uninstall_command_ = uninstall_command; 289 uninstall_command_ = uninstall_command;
290 } 290 }
291 }; 291 };
292 292
293 virtual void SetUp() override { 293 void SetUp() override {
294 SetupUtilTestWithDir::SetUp(); 294 SetupUtilTestWithDir::SetUp();
295 product_version_ = Version("30.0.1559.0"); 295 product_version_ = Version("30.0.1559.0");
296 max_version_ = Version("47.0.1559.0"); 296 max_version_ = Version("47.0.1559.0");
297 297
298 // Install the product according to the version. 298 // Install the product according to the version.
299 original_state_.reset(new FakeInstallationState()); 299 original_state_.reset(new FakeInstallationState());
300 InstallProduct(); 300 InstallProduct();
301 301
302 // Prepare to update the product in the temp dir. 302 // Prepare to update the product in the temp dir.
303 installer_state_.reset(new installer::InstallerState( 303 installer_state_.reset(new installer::InstallerState(
304 kSystemInstall_ ? installer::InstallerState::SYSTEM_LEVEL : 304 kSystemInstall_ ? installer::InstallerState::SYSTEM_LEVEL :
305 installer::InstallerState::USER_LEVEL)); 305 installer::InstallerState::USER_LEVEL));
306 installer_state_->AddProductFromState( 306 installer_state_->AddProductFromState(
307 kProductType_, 307 kProductType_,
308 *original_state_->GetProductState(kSystemInstall_, kProductType_)); 308 *original_state_->GetProductState(kSystemInstall_, kProductType_));
309 309
310 // Create archives in the two version dirs. 310 // Create archives in the two version dirs.
311 ASSERT_TRUE( 311 ASSERT_TRUE(
312 base::CreateDirectory(GetProductVersionArchivePath().DirName())); 312 base::CreateDirectory(GetProductVersionArchivePath().DirName()));
313 ASSERT_EQ(1, base::WriteFile(GetProductVersionArchivePath(), "a", 1)); 313 ASSERT_EQ(1, base::WriteFile(GetProductVersionArchivePath(), "a", 1));
314 ASSERT_TRUE( 314 ASSERT_TRUE(
315 base::CreateDirectory(GetMaxVersionArchivePath().DirName())); 315 base::CreateDirectory(GetMaxVersionArchivePath().DirName()));
316 ASSERT_EQ(1, base::WriteFile(GetMaxVersionArchivePath(), "b", 1)); 316 ASSERT_EQ(1, base::WriteFile(GetMaxVersionArchivePath(), "b", 1));
317 } 317 }
318 318
319 virtual void TearDown() override { 319 void TearDown() override {
320 original_state_.reset(); 320 original_state_.reset();
321 SetupUtilTestWithDir::TearDown(); 321 SetupUtilTestWithDir::TearDown();
322 } 322 }
323 323
324 base::FilePath GetArchivePath(const Version& version) const { 324 base::FilePath GetArchivePath(const Version& version) const {
325 return test_dir_.path() 325 return test_dir_.path()
326 .AppendASCII(version.GetString()) 326 .AppendASCII(version.GetString())
327 .Append(installer::kInstallerDir) 327 .Append(installer::kInstallerDir)
328 .Append(installer::kChromeArchive); 328 .Append(installer::kChromeArchive);
329 } 329 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 404
405 base::FilePath patch_source(installer::FindArchiveToPatch( 405 base::FilePath patch_source(installer::FindArchiveToPatch(
406 *original_state_, *installer_state_)); 406 *original_state_, *installer_state_));
407 EXPECT_EQ(base::FilePath::StringType(), patch_source.value()); 407 EXPECT_EQ(base::FilePath::StringType(), patch_source.value());
408 } 408 }
409 409
410 namespace { 410 namespace {
411 411
412 class MigrateMultiToSingleTest : public testing::Test { 412 class MigrateMultiToSingleTest : public testing::Test {
413 protected: 413 protected:
414 virtual void SetUp() override { 414 void SetUp() override {
415 registry_override_manager_.OverrideRegistry(kRootKey); 415 registry_override_manager_.OverrideRegistry(kRootKey);
416 } 416 }
417 417
418 static const bool kSystemLevel = false; 418 static const bool kSystemLevel = false;
419 static const HKEY kRootKey; 419 static const HKEY kRootKey;
420 static const wchar_t kVersionString[]; 420 static const wchar_t kVersionString[];
421 static const wchar_t kMultiChannel[]; 421 static const wchar_t kMultiChannel[];
422 registry_util::RegistryOverrideManager registry_override_manager_; 422 registry_util::RegistryOverrideManager registry_override_manager_;
423 }; 423 };
424 424
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 base::CommandLine::FromString(L"foo.exe --chrome-frame"))); 498 base::CommandLine::FromString(L"foo.exe --chrome-frame")));
499 } 499 }
500 500
501 TEST(SetupUtilTest, GetRegistrationDataCommandKey) { 501 TEST(SetupUtilTest, GetRegistrationDataCommandKey) {
502 base::string16 app_guid = L"{AAAAAAAA-BBBB-1111-0123-456789ABCDEF}"; 502 base::string16 app_guid = L"{AAAAAAAA-BBBB-1111-0123-456789ABCDEF}";
503 UpdatingAppRegistrationData reg_data(app_guid); 503 UpdatingAppRegistrationData reg_data(app_guid);
504 base::string16 key = 504 base::string16 key =
505 installer::GetRegistrationDataCommandKey(reg_data, L"test_name"); 505 installer::GetRegistrationDataCommandKey(reg_data, L"test_name");
506 EXPECT_TRUE(EndsWith(key, app_guid + L"\\Commands\\test_name", true)); 506 EXPECT_TRUE(EndsWith(key, app_guid + L"\\Commands\\test_name", true));
507 } 507 }
OLDNEW
« no previous file with comments | « chrome/installer/setup/install_worker_unittest.cc ('k') | chrome/installer/util/advanced_firewall_manager_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698