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 "chrome/installer/util/set_reg_value_work_item.h" | 5 #include "chrome/installer/util/set_reg_value_work_item.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 16 matching lines...) Expand all Loading... |
27 const wchar_t kNameDword[] = L"name_dword"; | 27 const wchar_t kNameDword[] = L"name_dword"; |
28 | 28 |
29 const DWORD kDword1 = 12345; | 29 const DWORD kDword1 = 12345; |
30 const DWORD kDword2 = 6789; | 30 const DWORD kDword2 = 6789; |
31 | 31 |
32 class SetRegValueWorkItemTest : public testing::Test { | 32 class SetRegValueWorkItemTest : public testing::Test { |
33 protected: | 33 protected: |
34 SetRegValueWorkItemTest() {} | 34 SetRegValueWorkItemTest() {} |
35 | 35 |
36 void SetUp() override { | 36 void SetUp() override { |
37 registry_override_manager_.OverrideRegistry(HKEY_CURRENT_USER); | 37 ASSERT_NO_FATAL_FAILURE( |
| 38 registry_override_manager_.OverrideRegistry(HKEY_CURRENT_USER)); |
38 | 39 |
39 // Create a temporary key for testing. | 40 // Create a temporary key for testing. |
40 ASSERT_NE(ERROR_SUCCESS, | 41 ASSERT_NE(ERROR_SUCCESS, |
41 test_key_.Open(HKEY_CURRENT_USER, kTestKey, KEY_READ)); | 42 test_key_.Open(HKEY_CURRENT_USER, kTestKey, KEY_READ)); |
42 ASSERT_EQ(ERROR_SUCCESS, test_key_.Create(HKEY_CURRENT_USER, kTestKey, | 43 ASSERT_EQ(ERROR_SUCCESS, test_key_.Create(HKEY_CURRENT_USER, kTestKey, |
43 KEY_READ | KEY_SET_VALUE)); | 44 KEY_READ | KEY_SET_VALUE)); |
44 } | 45 } |
45 | 46 |
46 base::win::RegKey test_key_; | 47 base::win::RegKey test_key_; |
47 | 48 |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 | 342 |
342 work_item->Rollback(); | 343 work_item->Rollback(); |
343 | 344 |
344 DWORD read_dword_out = 0; | 345 DWORD read_dword_out = 0; |
345 EXPECT_TRUE(test_key_.HasValue(kNameStr)); | 346 EXPECT_TRUE(test_key_.HasValue(kNameStr)); |
346 EXPECT_EQ(ERROR_SUCCESS, test_key_.ReadValueDW(kNameStr, &read_dword_out)); | 347 EXPECT_EQ(ERROR_SUCCESS, test_key_.ReadValueDW(kNameStr, &read_dword_out)); |
347 EXPECT_EQ(read_dword_out, kDword1); | 348 EXPECT_EQ(read_dword_out, kDword1); |
348 | 349 |
349 EXPECT_EQ(1, callback_invocation_count); | 350 EXPECT_EQ(1, callback_invocation_count); |
350 } | 351 } |
OLD | NEW |