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

Side by Side Diff: chrome/installer/util/installer_state_unittest.cc

Issue 99923002: Move temp file functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 <windows.h> 5 #include <windows.h>
6 6
7 #include <fstream> 7 #include <fstream>
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 // Is the Chrome version picked up? 467 // Is the Chrome version picked up?
468 scoped_ptr<Version> version(installer_state.GetCurrentVersion(machine_state)); 468 scoped_ptr<Version> version(installer_state.GetCurrentVersion(machine_state));
469 EXPECT_TRUE(version.get() != NULL); 469 EXPECT_TRUE(version.get() != NULL);
470 } 470 }
471 471
472 TEST_F(InstallerStateTest, IsFileInUse) { 472 TEST_F(InstallerStateTest, IsFileInUse) {
473 base::ScopedTempDir temp_dir; 473 base::ScopedTempDir temp_dir;
474 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 474 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
475 475
476 base::FilePath temp_file; 476 base::FilePath temp_file;
477 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir.path(), &temp_file)); 477 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir.path(), &temp_file));
478 478
479 EXPECT_FALSE(MockInstallerState::IsFileInUse(temp_file)); 479 EXPECT_FALSE(MockInstallerState::IsFileInUse(temp_file));
480 480
481 { 481 {
482 // Open a handle to the file with the same access mode and sharing options 482 // Open a handle to the file with the same access mode and sharing options
483 // as the loader. 483 // as the loader.
484 base::win::ScopedHandle temp_handle( 484 base::win::ScopedHandle temp_handle(
485 CreateFile(temp_file.value().c_str(), 485 CreateFile(temp_file.value().c_str(),
486 SYNCHRONIZE | FILE_EXECUTE, 486 SYNCHRONIZE | FILE_EXECUTE,
487 FILE_SHARE_DELETE | FILE_SHARE_READ, 487 FILE_SHARE_DELETE | FILE_SHARE_READ,
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 // Critical update newer than the new version. 748 // Critical update newer than the new version.
749 EXPECT_FALSE( 749 EXPECT_FALSE(
750 installer_state.DetermineCriticalVersion(NULL, *pv_version_).IsValid()); 750 installer_state.DetermineCriticalVersion(NULL, *pv_version_).IsValid());
751 EXPECT_FALSE( 751 EXPECT_FALSE(
752 installer_state.DetermineCriticalVersion(opv_version_, *pv_version_) 752 installer_state.DetermineCriticalVersion(opv_version_, *pv_version_)
753 .IsValid()); 753 .IsValid());
754 EXPECT_FALSE( 754 EXPECT_FALSE(
755 installer_state.DetermineCriticalVersion(pv_version_, *pv_version_) 755 installer_state.DetermineCriticalVersion(pv_version_, *pv_version_)
756 .IsValid()); 756 .IsValid());
757 } 757 }
OLDNEW
« no previous file with comments | « chrome/installer/util/delete_after_reboot_helper_unittest.cc ('k') | chrome/installer/util/master_preferences_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698