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

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

Issue 2692843002: Fail tests fast if overriding the Windows registry fails. (Closed)
Patch Set: sync to position 450085 Created 3 years, 10 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
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 "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
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
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 }
OLDNEW
« no previous file with comments | « chrome/installer/util/scoped_user_protocol_entry_unittest.cc ('k') | chrome/installer/util/shell_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698