| 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 "base/guid.h" | 7 #include "base/guid.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 KEY_ALL_ACCESS) != ERROR_SUCCESS) { | 26 KEY_ALL_ACCESS) != ERROR_SUCCESS) { |
| 27 // This will occur on first-run, but is harmless. | 27 // This will occur on first-run, but is harmless. |
| 28 return; | 28 return; |
| 29 } | 29 } |
| 30 | 30 |
| 31 base::win::RegistryKeyIterator iterator_test_root_key(HKEY_CURRENT_USER, | 31 base::win::RegistryKeyIterator iterator_test_root_key(HKEY_CURRENT_USER, |
| 32 test_key_root.c_str()); | 32 test_key_root.c_str()); |
| 33 for (; iterator_test_root_key.Valid(); ++iterator_test_root_key) { | 33 for (; iterator_test_root_key.Valid(); ++iterator_test_root_key) { |
| 34 base::string16 key_name = iterator_test_root_key.Name(); | 34 base::string16 key_name = iterator_test_root_key.Name(); |
| 35 std::vector<base::string16> tokens; | 35 std::vector<base::string16> tokens; |
| 36 Tokenize(key_name, base::string16(kTimestampDelimiter), &tokens); | 36 if (!Tokenize(key_name, base::string16(kTimestampDelimiter), &tokens)) |
| 37 continue; |
| 37 int64 key_name_as_number = 0; | 38 int64 key_name_as_number = 0; |
| 38 | 39 |
| 39 if (!base::StringToInt64(tokens[0], &key_name_as_number)) { | 40 if (!base::StringToInt64(tokens[0], &key_name_as_number)) { |
| 40 test_root_key.DeleteKey(key_name.c_str()); | 41 test_root_key.DeleteKey(key_name.c_str()); |
| 41 continue; | 42 continue; |
| 42 } | 43 } |
| 43 | 44 |
| 44 base::Time key_time = base::Time::FromInternalValue(key_name_as_number); | 45 base::Time key_time = base::Time::FromInternalValue(key_name_as_number); |
| 45 base::TimeDelta age = now - key_time; | 46 base::TimeDelta age = now - key_time; |
| 46 | 47 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 base::string16 key_path = GenerateTempKeyPath(test_key_root_, timestamp_); | 98 base::string16 key_path = GenerateTempKeyPath(test_key_root_, timestamp_); |
| 98 overrides_.push_back(new ScopedRegistryKeyOverride(override, key_path)); | 99 overrides_.push_back(new ScopedRegistryKeyOverride(override, key_path)); |
| 99 } | 100 } |
| 100 | 101 |
| 101 base::string16 GenerateTempKeyPath() { | 102 base::string16 GenerateTempKeyPath() { |
| 102 return GenerateTempKeyPath(base::string16(kTempTestKeyPath), | 103 return GenerateTempKeyPath(base::string16(kTempTestKeyPath), |
| 103 base::Time::Now()); | 104 base::Time::Now()); |
| 104 } | 105 } |
| 105 | 106 |
| 106 } // namespace registry_util | 107 } // namespace registry_util |
| OLD | NEW |