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

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

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 ASSERT_TRUE(base::PathExists(chrome_dir)); 130 ASSERT_TRUE(base::PathExists(chrome_dir));
131 131
132 version.reset(installer::GetMaxVersionFromArchiveDir(test_dir_.path())); 132 version.reset(installer::GetMaxVersionFromArchiveDir(test_dir_.path()));
133 ASSERT_EQ(version->GetString(), "9.9.9.9"); 133 ASSERT_EQ(version->GetString(), "9.9.9.9");
134 } 134 }
135 135
136 TEST_F(SetupUtilTestWithDir, DeleteFileFromTempProcess) { 136 TEST_F(SetupUtilTestWithDir, DeleteFileFromTempProcess) {
137 base::FilePath test_file; 137 base::FilePath test_file;
138 base::CreateTemporaryFileInDir(test_dir_.path(), &test_file); 138 base::CreateTemporaryFileInDir(test_dir_.path(), &test_file);
139 ASSERT_TRUE(base::PathExists(test_file)); 139 ASSERT_TRUE(base::PathExists(test_file));
140 file_util::WriteFile(test_file, "foo", 3); 140 base::WriteFile(test_file, "foo", 3);
141 EXPECT_TRUE(installer::DeleteFileFromTempProcess(test_file, 0)); 141 EXPECT_TRUE(installer::DeleteFileFromTempProcess(test_file, 0));
142 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(200)); 142 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(200));
143 EXPECT_FALSE(base::PathExists(test_file)); 143 EXPECT_FALSE(base::PathExists(test_file));
144 } 144 }
145 145
146 // Note: This test is only valid when run at high integrity (i.e. it will fail 146 // Note: This test is only valid when run at high integrity (i.e. it will fail
147 // at medium integrity). 147 // at medium integrity).
148 TEST(SetupUtilTest, ScopedTokenPrivilegeBasic) { 148 TEST(SetupUtilTest, ScopedTokenPrivilegeBasic) {
149 ASSERT_FALSE(CurrentProcessHasPrivilege(kTestedPrivilege)); 149 ASSERT_FALSE(CurrentProcessHasPrivilege(kTestedPrivilege));
150 150
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 installer_state_.reset(new installer::InstallerState( 300 installer_state_.reset(new installer::InstallerState(
301 kSystemInstall_ ? installer::InstallerState::SYSTEM_LEVEL : 301 kSystemInstall_ ? installer::InstallerState::SYSTEM_LEVEL :
302 installer::InstallerState::USER_LEVEL)); 302 installer::InstallerState::USER_LEVEL));
303 installer_state_->AddProductFromState( 303 installer_state_->AddProductFromState(
304 kProductType_, 304 kProductType_,
305 *original_state_->GetProductState(kSystemInstall_, kProductType_)); 305 *original_state_->GetProductState(kSystemInstall_, kProductType_));
306 306
307 // Create archives in the two version dirs. 307 // Create archives in the two version dirs.
308 ASSERT_TRUE( 308 ASSERT_TRUE(
309 base::CreateDirectory(GetProductVersionArchivePath().DirName())); 309 base::CreateDirectory(GetProductVersionArchivePath().DirName()));
310 ASSERT_EQ(1, file_util::WriteFile(GetProductVersionArchivePath(), "a", 1)); 310 ASSERT_EQ(1, base::WriteFile(GetProductVersionArchivePath(), "a", 1));
311 ASSERT_TRUE( 311 ASSERT_TRUE(
312 base::CreateDirectory(GetMaxVersionArchivePath().DirName())); 312 base::CreateDirectory(GetMaxVersionArchivePath().DirName()));
313 ASSERT_EQ(1, file_util::WriteFile(GetMaxVersionArchivePath(), "b", 1)); 313 ASSERT_EQ(1, base::WriteFile(GetMaxVersionArchivePath(), "b", 1));
314 } 314 }
315 315
316 virtual void TearDown() OVERRIDE { 316 virtual void TearDown() OVERRIDE {
317 original_state_.reset(); 317 original_state_.reset();
318 SetupUtilTestWithDir::TearDown(); 318 SetupUtilTestWithDir::TearDown();
319 } 319 }
320 320
321 base::FilePath GetArchivePath(const Version& version) const { 321 base::FilePath GetArchivePath(const Version& version) const {
322 return test_dir_.path() 322 return test_dir_.path()
323 .AppendASCII(version.GetString()) 323 .AppendASCII(version.GetString())
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 } 487 }
488 488
489 TEST(SetupUtilTest, ContainsUnsupportedSwitch) { 489 TEST(SetupUtilTest, ContainsUnsupportedSwitch) {
490 EXPECT_FALSE(installer::ContainsUnsupportedSwitch( 490 EXPECT_FALSE(installer::ContainsUnsupportedSwitch(
491 CommandLine::FromString(L"foo.exe"))); 491 CommandLine::FromString(L"foo.exe")));
492 EXPECT_FALSE(installer::ContainsUnsupportedSwitch( 492 EXPECT_FALSE(installer::ContainsUnsupportedSwitch(
493 CommandLine::FromString(L"foo.exe --multi-install --chrome"))); 493 CommandLine::FromString(L"foo.exe --multi-install --chrome")));
494 EXPECT_TRUE(installer::ContainsUnsupportedSwitch( 494 EXPECT_TRUE(installer::ContainsUnsupportedSwitch(
495 CommandLine::FromString(L"foo.exe --chrome-frame"))); 495 CommandLine::FromString(L"foo.exe --chrome-frame")));
496 } 496 }
OLDNEW
« no previous file with comments | « chrome/installer/setup/setup_main.cc ('k') | chrome/installer/test/alternate_version_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698