OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/registry.h" | 5 #include "base/registry.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 | 7 |
8 namespace { | 8 namespace { |
9 | 9 |
10 const wchar_t kRootKey[] = L"Base_Registry_Unittest"; | 10 const wchar_t kRootKey[] = L"Base_Registry_Unittest"; |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 std::wstring foo_key(kRootKey); | 38 std::wstring foo_key(kRootKey); |
39 foo_key += L"\\Foo"; | 39 foo_key += L"\\Foo"; |
40 ASSERT_TRUE(key.Create(HKEY_CURRENT_USER, foo_key.c_str(), KEY_READ)); | 40 ASSERT_TRUE(key.Create(HKEY_CURRENT_USER, foo_key.c_str(), KEY_READ)); |
41 | 41 |
42 { | 42 { |
43 ASSERT_TRUE(key.Open(HKEY_CURRENT_USER, foo_key.c_str(), | 43 ASSERT_TRUE(key.Open(HKEY_CURRENT_USER, foo_key.c_str(), |
44 KEY_READ | KEY_SET_VALUE)); | 44 KEY_READ | KEY_SET_VALUE)); |
45 | 45 |
46 const wchar_t* kName = L"Bar"; | 46 const wchar_t* kName = L"Bar"; |
47 EXPECT_TRUE(key.WriteValue(kName, L"bar")); | 47 const wchar_t* kValue = L"bar"; |
| 48 EXPECT_TRUE(key.WriteValue(kName, kValue)); |
48 EXPECT_TRUE(key.ValueExists(kName)); | 49 EXPECT_TRUE(key.ValueExists(kName)); |
| 50 std::wstring out_value; |
| 51 EXPECT_TRUE(key.ReadValue(kName, &out_value)); |
| 52 EXPECT_NE(out_value, L""); |
| 53 EXPECT_STREQ(out_value.c_str(), kValue); |
49 EXPECT_TRUE(key.DeleteValue(kName)); | 54 EXPECT_TRUE(key.DeleteValue(kName)); |
50 } | 55 } |
51 } | 56 } |
52 | 57 |
53 } // namespace | 58 } // namespace |
OLD | NEW |