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

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

Issue 1109043003: Apply automated fixits for Chrome clang plugin to chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 <windows.h> 5 #include <windows.h>
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/win/registry.h" 10 #include "base/win/registry.h"
11 #include "chrome/installer/util/delete_reg_value_work_item.h" 11 #include "chrome/installer/util/delete_reg_value_work_item.h"
12 #include "chrome/installer/util/work_item.h" 12 #include "chrome/installer/util/work_item.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 using base::win::RegKey; 15 using base::win::RegKey;
16 16
17 namespace { 17 namespace {
18 18
19 const wchar_t kTestRoot[] = L"DeleteRegValueWorkItemTest"; 19 const wchar_t kTestRoot[] = L"DeleteRegValueWorkItemTest";
20 const wchar_t kWriteNew[] = L"WriteNew"; 20 const wchar_t kWriteNew[] = L"WriteNew";
21 const wchar_t kNameStr[] = L"name_str"; 21 const wchar_t kNameStr[] = L"name_str";
22 const wchar_t kNameDword[] = L"name_dword"; 22 const wchar_t kNameDword[] = L"name_dword";
23 23
24 class DeleteRegValueWorkItemTest : public testing::Test { 24 class DeleteRegValueWorkItemTest : public testing::Test {
25 protected: 25 protected:
26 virtual void SetUp() { 26 void SetUp() override {
27 // Create a temporary key for testing 27 // Create a temporary key for testing
28 RegKey key(HKEY_CURRENT_USER, L"", KEY_ALL_ACCESS); 28 RegKey key(HKEY_CURRENT_USER, L"", KEY_ALL_ACCESS);
29 key.DeleteKey(kTestRoot); 29 key.DeleteKey(kTestRoot);
30 ASSERT_NE(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, kTestRoot, KEY_READ)); 30 ASSERT_NE(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, kTestRoot, KEY_READ));
31 ASSERT_EQ(ERROR_SUCCESS, 31 ASSERT_EQ(ERROR_SUCCESS,
32 key.Create(HKEY_CURRENT_USER, kTestRoot, KEY_READ)); 32 key.Create(HKEY_CURRENT_USER, kTestRoot, KEY_READ));
33 } 33 }
34 virtual void TearDown() { 34 void TearDown() override {
35 logging::CloseLogFile(); 35 logging::CloseLogFile();
36 // Clean up the temporary key 36 // Clean up the temporary key
37 RegKey key(HKEY_CURRENT_USER, L"", KEY_ALL_ACCESS); 37 RegKey key(HKEY_CURRENT_USER, L"", KEY_ALL_ACCESS);
38 ASSERT_EQ(ERROR_SUCCESS, key.DeleteKey(kTestRoot)); 38 ASSERT_EQ(ERROR_SUCCESS, key.DeleteKey(kTestRoot));
39 } 39 }
40 }; 40 };
41 41
42 } // namespace 42 } // namespace
43 43
44 // Delete a value. The value should get deleted after Do() and should be 44 // Delete a value. The value should get deleted after Do() and should be
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 EXPECT_FALSE(key.HasValue(name_str.c_str())); 125 EXPECT_FALSE(key.HasValue(name_str.c_str()));
126 EXPECT_FALSE(key.HasValue(name_dword.c_str())); 126 EXPECT_FALSE(key.HasValue(name_dword.c_str()));
127 127
128 work_item1->Rollback(); 128 work_item1->Rollback();
129 work_item2->Rollback(); 129 work_item2->Rollback();
130 130
131 EXPECT_FALSE(key.HasValue(name_str.c_str())); 131 EXPECT_FALSE(key.HasValue(name_str.c_str()));
132 EXPECT_FALSE(key.HasValue(name_dword.c_str())); 132 EXPECT_FALSE(key.HasValue(name_dword.c_str()));
133 } 133 }
OLDNEW
« no previous file with comments | « chrome/installer/util/delete_reg_value_work_item.h ('k') | chrome/installer/util/delete_tree_work_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698