| OLD | NEW |
| 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" | 5 #include "base/test/test_reg_util_win.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 EXPECT_EQ(42u, value); | 94 EXPECT_EQ(42u, value); |
| 95 read_key.Close(); | 95 read_key.Close(); |
| 96 | 96 |
| 97 manager_.reset(); | 97 manager_.reset(); |
| 98 | 98 |
| 99 AssertKeyAbsent(kTestKeyPath); | 99 AssertKeyAbsent(kTestKeyPath); |
| 100 } | 100 } |
| 101 | 101 |
| 102 TEST_F(RegistryOverrideManagerTest, DeleteStaleKeys) { | 102 TEST_F(RegistryOverrideManagerTest, DeleteStaleKeys) { |
| 103 base::Time::Exploded kTestTimeExploded = {2013, 11, 1, 4, 0, 0, 0, 0}; | 103 base::Time::Exploded kTestTimeExploded = {2013, 11, 1, 4, 0, 0, 0, 0}; |
| 104 base::Time kTestTime = base::Time::FromUTCExploded(kTestTimeExploded); | 104 base::Time kTestTime; |
| 105 EXPECT_TRUE(base::Time::FromUTCExploded(kTestTimeExploded, &kTestTime)); |
| 105 | 106 |
| 106 base::string16 path_garbage = fake_test_key_root_ + L"\\Blah"; | 107 base::string16 path_garbage = fake_test_key_root_ + L"\\Blah"; |
| 107 base::string16 path_very_stale = | 108 base::string16 path_very_stale = |
| 108 FakeOverrideManagerPath(kTestTime - base::TimeDelta::FromDays(100)); | 109 FakeOverrideManagerPath(kTestTime - base::TimeDelta::FromDays(100)); |
| 109 base::string16 path_stale = | 110 base::string16 path_stale = |
| 110 FakeOverrideManagerPath(kTestTime - base::TimeDelta::FromDays(5)); | 111 FakeOverrideManagerPath(kTestTime - base::TimeDelta::FromDays(5)); |
| 111 base::string16 path_current = | 112 base::string16 path_current = |
| 112 FakeOverrideManagerPath(kTestTime - base::TimeDelta::FromMinutes(1)); | 113 FakeOverrideManagerPath(kTestTime - base::TimeDelta::FromMinutes(1)); |
| 113 base::string16 path_future = | 114 base::string16 path_future = |
| 114 FakeOverrideManagerPath(kTestTime + base::TimeDelta::FromMinutes(1)); | 115 FakeOverrideManagerPath(kTestTime + base::TimeDelta::FromMinutes(1)); |
| 115 | 116 |
| 116 CreateKey(path_garbage); | 117 CreateKey(path_garbage); |
| 117 CreateKey(path_very_stale); | 118 CreateKey(path_very_stale); |
| 118 CreateKey(path_stale); | 119 CreateKey(path_stale); |
| 119 CreateKey(path_current); | 120 CreateKey(path_current); |
| 120 CreateKey(path_future); | 121 CreateKey(path_future); |
| 121 | 122 |
| 122 CreateManager(kTestTime); | 123 CreateManager(kTestTime); |
| 123 manager_.reset(); | 124 manager_.reset(); |
| 124 | 125 |
| 125 AssertKeyAbsent(path_garbage); | 126 AssertKeyAbsent(path_garbage); |
| 126 AssertKeyAbsent(path_very_stale); | 127 AssertKeyAbsent(path_very_stale); |
| 127 AssertKeyAbsent(path_stale); | 128 AssertKeyAbsent(path_stale); |
| 128 AssertKeyExists(path_current); | 129 AssertKeyExists(path_current); |
| 129 AssertKeyExists(path_future); | 130 AssertKeyExists(path_future); |
| 130 } | 131 } |
| 131 | 132 |
| 132 } // namespace registry_util | 133 } // namespace registry_util |
| OLD | NEW |