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

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

Issue 11359217: Move scoped_temp_dir from base to base/files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 <string> 7 #include <string>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/scoped_temp_dir.h"
11 #include "base/memory/scoped_ptr.h"
10 #include "base/path_service.h" 12 #include "base/path_service.h"
11 #include "base/scoped_temp_dir.h" 13 #include "base/threading/platform_thread.h"
12 #include "base/time.h" 14 #include "base/time.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/threading/platform_thread.h"
15 #include "base/win/scoped_handle.h" 15 #include "base/win/scoped_handle.h"
16 #include "chrome/common/chrome_paths.h" 16 #include "chrome/common/chrome_paths.h"
17 #include "chrome/installer/setup/setup_util.h" 17 #include "chrome/installer/setup/setup_util.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 19
20 namespace { 20 namespace {
21 21
22 class SetupUtilTestWithDir : public testing::Test { 22 class SetupUtilTestWithDir : public testing::Test {
23 protected: 23 protected:
24 virtual void SetUp() { 24 virtual void SetUp() {
25 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_dir_)); 25 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_dir_));
26 data_dir_ = data_dir_.AppendASCII("installer"); 26 data_dir_ = data_dir_.AppendASCII("installer");
27 ASSERT_TRUE(file_util::PathExists(data_dir_)); 27 ASSERT_TRUE(file_util::PathExists(data_dir_));
28 28
29 // Create a temp directory for testing. 29 // Create a temp directory for testing.
30 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); 30 ASSERT_TRUE(test_dir_.CreateUniqueTempDir());
31 } 31 }
32 32
33 virtual void TearDown() { 33 virtual void TearDown() {
34 // Clean up test directory manually so we can fail if it leaks. 34 // Clean up test directory manually so we can fail if it leaks.
35 ASSERT_TRUE(test_dir_.Delete()); 35 ASSERT_TRUE(test_dir_.Delete());
36 } 36 }
37 37
38 // The temporary directory used to contain the test operations. 38 // The temporary directory used to contain the test operations.
39 ScopedTempDir test_dir_; 39 base::ScopedTempDir test_dir_;
40 40
41 // The path to input data used in tests. 41 // The path to input data used in tests.
42 FilePath data_dir_; 42 FilePath data_dir_;
43 }; 43 };
44 44
45 // The privilege tested in ScopeTokenPrivilege tests below. 45 // The privilege tested in ScopeTokenPrivilege tests below.
46 // Use SE_RESTORE_NAME as it is one of the many privileges that is available, 46 // Use SE_RESTORE_NAME as it is one of the many privileges that is available,
47 // but not enabled by default on processes running at high integrity. 47 // but not enabled by default on processes running at high integrity.
48 static const wchar_t kTestedPrivilege[] = SE_RESTORE_NAME; 48 static const wchar_t kTestedPrivilege[] = SE_RESTORE_NAME;
49 49
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 { 181 {
182 installer::ScopedTokenPrivilege dup_scoped_privilege(kTestedPrivilege); 182 installer::ScopedTokenPrivilege dup_scoped_privilege(kTestedPrivilege);
183 ASSERT_TRUE(dup_scoped_privilege.is_enabled()); 183 ASSERT_TRUE(dup_scoped_privilege.is_enabled());
184 ASSERT_TRUE(CurrentProcessHasPrivilege(kTestedPrivilege)); 184 ASSERT_TRUE(CurrentProcessHasPrivilege(kTestedPrivilege));
185 } 185 }
186 ASSERT_TRUE(CurrentProcessHasPrivilege(kTestedPrivilege)); 186 ASSERT_TRUE(CurrentProcessHasPrivilege(kTestedPrivilege));
187 } 187 }
188 188
189 ASSERT_FALSE(CurrentProcessHasPrivilege(kTestedPrivilege)); 189 ASSERT_FALSE(CurrentProcessHasPrivilege(kTestedPrivilege));
190 } 190 }
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