| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <stdint.h> |
| 8 |
| 7 #include "base/guid.h" | 9 #include "base/guid.h" |
| 8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 9 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
| 11 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 16 |
| 15 namespace registry_util { | 17 namespace registry_util { |
| 16 | 18 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 31 | 33 |
| 32 base::win::RegistryKeyIterator iterator_test_root_key(HKEY_CURRENT_USER, | 34 base::win::RegistryKeyIterator iterator_test_root_key(HKEY_CURRENT_USER, |
| 33 test_key_root.c_str()); | 35 test_key_root.c_str()); |
| 34 for (; iterator_test_root_key.Valid(); ++iterator_test_root_key) { | 36 for (; iterator_test_root_key.Valid(); ++iterator_test_root_key) { |
| 35 base::string16 key_name = iterator_test_root_key.Name(); | 37 base::string16 key_name = iterator_test_root_key.Name(); |
| 36 std::vector<base::string16> tokens = base::SplitString( | 38 std::vector<base::string16> tokens = base::SplitString( |
| 37 key_name, kTimestampDelimiter, base::KEEP_WHITESPACE, | 39 key_name, kTimestampDelimiter, base::KEEP_WHITESPACE, |
| 38 base::SPLIT_WANT_NONEMPTY); | 40 base::SPLIT_WANT_NONEMPTY); |
| 39 if (tokens.empty()) | 41 if (tokens.empty()) |
| 40 continue; | 42 continue; |
| 41 int64 key_name_as_number = 0; | 43 int64_t key_name_as_number = 0; |
| 42 | 44 |
| 43 if (!base::StringToInt64(tokens[0], &key_name_as_number)) { | 45 if (!base::StringToInt64(tokens[0], &key_name_as_number)) { |
| 44 test_root_key.DeleteKey(key_name.c_str()); | 46 test_root_key.DeleteKey(key_name.c_str()); |
| 45 continue; | 47 continue; |
| 46 } | 48 } |
| 47 | 49 |
| 48 base::Time key_time = base::Time::FromInternalValue(key_name_as_number); | 50 base::Time key_time = base::Time::FromInternalValue(key_name_as_number); |
| 49 base::TimeDelta age = now - key_time; | 51 base::TimeDelta age = now - key_time; |
| 50 | 52 |
| 51 if (age > base::TimeDelta::FromHours(24)) | 53 if (age > base::TimeDelta::FromHours(24)) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 overrides_.push_back( | 102 overrides_.push_back( |
| 101 make_scoped_ptr(new ScopedRegistryKeyOverride(override, key_path))); | 103 make_scoped_ptr(new ScopedRegistryKeyOverride(override, key_path))); |
| 102 } | 104 } |
| 103 | 105 |
| 104 base::string16 GenerateTempKeyPath() { | 106 base::string16 GenerateTempKeyPath() { |
| 105 return GenerateTempKeyPath(base::string16(kTempTestKeyPath), | 107 return GenerateTempKeyPath(base::string16(kTempTestKeyPath), |
| 106 base::Time::Now()); | 108 base::Time::Now()); |
| 107 } | 109 } |
| 108 | 110 |
| 109 } // namespace registry_util | 111 } // namespace registry_util |
| OLD | NEW |