OLD | NEW |
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 "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" |
9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
10 #include "base/path_service.h" | 11 #include "base/path_service.h" |
11 #include "base/scoped_temp_dir.h" | |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "base/win/registry.h" | 13 #include "base/win/registry.h" |
14 #include "chrome/installer/util/conditional_work_item_list.h" | 14 #include "chrome/installer/util/conditional_work_item_list.h" |
15 #include "chrome/installer/util/work_item.h" | 15 #include "chrome/installer/util/work_item.h" |
16 #include "chrome/installer/util/work_item_list.h" | 16 #include "chrome/installer/util/work_item_list.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 | 18 |
19 using base::win::RegKey; | 19 using base::win::RegKey; |
20 | 20 |
21 namespace { | 21 namespace { |
(...skipping 16 matching lines...) Expand all Loading... |
38 } | 38 } |
39 | 39 |
40 virtual void TearDown() { | 40 virtual void TearDown() { |
41 logging::CloseLogFile(); | 41 logging::CloseLogFile(); |
42 | 42 |
43 // Clean up the temporary key | 43 // Clean up the temporary key |
44 RegKey key(HKEY_CURRENT_USER, L"", KEY_ALL_ACCESS); | 44 RegKey key(HKEY_CURRENT_USER, L"", KEY_ALL_ACCESS); |
45 ASSERT_EQ(ERROR_SUCCESS, key.DeleteKey(kTestRoot)); | 45 ASSERT_EQ(ERROR_SUCCESS, key.DeleteKey(kTestRoot)); |
46 } | 46 } |
47 | 47 |
48 ScopedTempDir temp_dir_; | 48 base::ScopedTempDir temp_dir_; |
49 }; | 49 }; |
50 | 50 |
51 } // namespace | 51 } // namespace |
52 | 52 |
53 // Execute a WorkItem list successfully and then rollback. | 53 // Execute a WorkItem list successfully and then rollback. |
54 TEST_F(WorkItemListTest, ExecutionSuccess) { | 54 TEST_F(WorkItemListTest, ExecutionSuccess) { |
55 scoped_ptr<WorkItemList> work_item_list(WorkItem::CreateWorkItemList()); | 55 scoped_ptr<WorkItemList> work_item_list(WorkItem::CreateWorkItemList()); |
56 scoped_ptr<WorkItem> work_item; | 56 scoped_ptr<WorkItem> work_item; |
57 | 57 |
58 FilePath top_dir_to_create(temp_dir_.path()); | 58 FilePath top_dir_to_create(temp_dir_.path()); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 267 |
268 work_item_list->Rollback(); | 268 work_item_list->Rollback(); |
269 | 269 |
270 // Verify everything is rolled back. | 270 // Verify everything is rolled back. |
271 // The value must have been deleted first in roll back otherwise the key | 271 // The value must have been deleted first in roll back otherwise the key |
272 // can not be deleted. | 272 // can not be deleted. |
273 EXPECT_NE(ERROR_SUCCESS, | 273 EXPECT_NE(ERROR_SUCCESS, |
274 key.Open(HKEY_CURRENT_USER, key_to_create.c_str(), KEY_READ)); | 274 key.Open(HKEY_CURRENT_USER, key_to_create.c_str(), KEY_READ)); |
275 EXPECT_FALSE(file_util::PathExists(top_dir_to_create)); | 275 EXPECT_FALSE(file_util::PathExists(top_dir_to_create)); |
276 } | 276 } |
OLD | NEW |