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

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

Issue 606473002: Remove implicit HANDLE conversions from chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove spurious file and fix indent (+rebase) Created 6 years, 2 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
« no previous file with comments | « chrome/installer/util/google_update_util.cc ('k') | chrome/installer/util/user_experiment.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
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,
488 NULL, OPEN_EXISTING, 0, 0)); 488 NULL, OPEN_EXISTING, 0, 0));
489 ASSERT_TRUE(temp_handle != NULL); 489 ASSERT_TRUE(temp_handle.IsValid());
490 490
491 // The file should now be in use. 491 // The file should now be in use.
492 EXPECT_TRUE(MockInstallerState::IsFileInUse(temp_file)); 492 EXPECT_TRUE(MockInstallerState::IsFileInUse(temp_file));
493 } 493 }
494 494
495 // And once the handle is gone, it should no longer be in use. 495 // And once the handle is gone, it should no longer be in use.
496 EXPECT_FALSE(MockInstallerState::IsFileInUse(temp_file)); 496 EXPECT_FALSE(MockInstallerState::IsFileInUse(temp_file));
497 } 497 }
498 498
499 TEST_F(InstallerStateTest, RemoveOldVersionDirs) { 499 TEST_F(InstallerStateTest, RemoveOldVersionDirs) {
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 // Critical update newer than the new version. 818 // Critical update newer than the new version.
819 EXPECT_FALSE( 819 EXPECT_FALSE(
820 installer_state.DetermineCriticalVersion(NULL, *pv_version_).IsValid()); 820 installer_state.DetermineCriticalVersion(NULL, *pv_version_).IsValid());
821 EXPECT_FALSE( 821 EXPECT_FALSE(
822 installer_state.DetermineCriticalVersion(opv_version_, *pv_version_) 822 installer_state.DetermineCriticalVersion(opv_version_, *pv_version_)
823 .IsValid()); 823 .IsValid());
824 EXPECT_FALSE( 824 EXPECT_FALSE(
825 installer_state.DetermineCriticalVersion(pv_version_, *pv_version_) 825 installer_state.DetermineCriticalVersion(pv_version_, *pv_version_)
826 .IsValid()); 826 .IsValid());
827 } 827 }
OLDNEW
« no previous file with comments | « chrome/installer/util/google_update_util.cc ('k') | chrome/installer/util/user_experiment.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698