OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 "components/user_prefs/tracked/registry_hash_store_contents_win.h" | 5 #include "components/user_prefs/tracked/registry_hash_store_contents_win.h" |
6 | 6 |
7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/test/test_reg_util_win.h" | 9 #include "base/test/test_reg_util_win.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "base/win/registry.h" | 11 #include "base/win/registry.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 constexpr base::char16 kRegistryPath[] = L"Foo\\TestStore"; | 16 constexpr base::char16 kRegistryPath[] = L"Foo\\TestStore"; |
17 constexpr base::char16 kStoreKey[] = L"test_store_key"; | 17 constexpr base::char16 kStoreKey[] = L"test_store_key"; |
18 | 18 |
19 // MACs are 32 characters long. | 19 // Hex-encoded MACs are 64 characters long. |
20 constexpr char kTestStringA[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; | 20 constexpr char kTestStringA[] = |
21 constexpr char kTestStringB[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"; | 21 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; |
| 22 constexpr char kTestStringB[] = |
| 23 "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"; |
22 | 24 |
23 constexpr char kAtomicPrefPath[] = "path1"; | 25 constexpr char kAtomicPrefPath[] = "path1"; |
24 constexpr char kSplitPrefPath[] = "extension"; | 26 constexpr char kSplitPrefPath[] = "extension"; |
25 | 27 |
26 class RegistryHashStoreContentsWinTest : public testing::Test { | 28 class RegistryHashStoreContentsWinTest : public testing::Test { |
27 protected: | 29 protected: |
28 RegistryHashStoreContentsWinTest() {} | 30 RegistryHashStoreContentsWinTest() {} |
29 | 31 |
30 void SetUp() override { | 32 void SetUp() override { |
31 registry_override_manager_.OverrideRegistry(HKEY_CURRENT_USER); | 33 registry_override_manager_.OverrideRegistry(HKEY_CURRENT_USER); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 109 |
108 contents->Reset(); | 110 contents->Reset(); |
109 | 111 |
110 stored_mac.clear(); | 112 stored_mac.clear(); |
111 EXPECT_FALSE(contents->GetMac(kAtomicPrefPath, &stored_mac)); | 113 EXPECT_FALSE(contents->GetMac(kAtomicPrefPath, &stored_mac)); |
112 EXPECT_TRUE(stored_mac.empty()); | 114 EXPECT_TRUE(stored_mac.empty()); |
113 | 115 |
114 split_macs.clear(); | 116 split_macs.clear(); |
115 EXPECT_FALSE(contents->GetSplitMacs(kSplitPrefPath, &split_macs)); | 117 EXPECT_FALSE(contents->GetSplitMacs(kSplitPrefPath, &split_macs)); |
116 EXPECT_EQ(0U, split_macs.size()); | 118 EXPECT_EQ(0U, split_macs.size()); |
117 } | 119 } |
OLD | NEW |