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

Side by Side Diff: base/test/test_reg_util_win_unittest.cc

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 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
« no previous file with comments | « base/test/test_reg_util_win.cc ('k') | base/test/test_suite.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/test/test_reg_util_win.h"
6
7 #include <memory>
8
5 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
6 #include "base/memory/scoped_ptr.h"
7 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
9 #include "base/test/test_reg_util_win.h"
10 #include "base/time/time.h" 12 #include "base/time/time.h"
11 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
12 14
13 namespace registry_util { 15 namespace registry_util {
14 16
15 namespace { 17 namespace {
16 const wchar_t kTestKeyPath[] = L"Software\\Chromium\\Foo\\Baz\\TestKey"; 18 const wchar_t kTestKeyPath[] = L"Software\\Chromium\\Foo\\Baz\\TestKey";
17 const wchar_t kTestValueName[] = L"TestValue"; 19 const wchar_t kTestValueName[] = L"TestValue";
18 } // namespace 20 } // namespace
19 21
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 return fake_test_key_root_ + L"\\" + 63 return fake_test_key_root_ + L"\\" +
62 base::Int64ToString16(time.ToInternalValue()); 64 base::Int64ToString16(time.ToInternalValue());
63 } 65 }
64 66
65 void CreateManager(const base::Time& timestamp) { 67 void CreateManager(const base::Time& timestamp) {
66 manager_.reset(new RegistryOverrideManager(timestamp, fake_test_key_root_)); 68 manager_.reset(new RegistryOverrideManager(timestamp, fake_test_key_root_));
67 manager_->OverrideRegistry(HKEY_CURRENT_USER); 69 manager_->OverrideRegistry(HKEY_CURRENT_USER);
68 } 70 }
69 71
70 base::string16 fake_test_key_root_; 72 base::string16 fake_test_key_root_;
71 scoped_ptr<RegistryOverrideManager> manager_; 73 std::unique_ptr<RegistryOverrideManager> manager_;
72 }; 74 };
73 75
74 TEST_F(RegistryOverrideManagerTest, Basic) { 76 TEST_F(RegistryOverrideManagerTest, Basic) {
75 CreateManager(base::Time::Now()); 77 CreateManager(base::Time::Now());
76 78
77 base::win::RegKey create_key; 79 base::win::RegKey create_key;
78 EXPECT_EQ(ERROR_SUCCESS, 80 EXPECT_EQ(ERROR_SUCCESS,
79 create_key.Create(HKEY_CURRENT_USER, kTestKeyPath, KEY_ALL_ACCESS)); 81 create_key.Create(HKEY_CURRENT_USER, kTestKeyPath, KEY_ALL_ACCESS));
80 EXPECT_TRUE(create_key.Valid()); 82 EXPECT_TRUE(create_key.Valid());
81 EXPECT_EQ(ERROR_SUCCESS, create_key.WriteValue(kTestValueName, 42)); 83 EXPECT_EQ(ERROR_SUCCESS, create_key.WriteValue(kTestValueName, 42));
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 manager_.reset(); 123 manager_.reset();
122 124
123 AssertKeyAbsent(path_garbage); 125 AssertKeyAbsent(path_garbage);
124 AssertKeyAbsent(path_very_stale); 126 AssertKeyAbsent(path_very_stale);
125 AssertKeyAbsent(path_stale); 127 AssertKeyAbsent(path_stale);
126 AssertKeyExists(path_current); 128 AssertKeyExists(path_current);
127 AssertKeyExists(path_future); 129 AssertKeyExists(path_future);
128 } 130 }
129 131
130 } // namespace registry_util 132 } // namespace registry_util
OLDNEW
« no previous file with comments | « base/test/test_reg_util_win.cc ('k') | base/test/test_suite.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698