OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/win/chrome_elf_init.h" | 5 #include "chrome/browser/win/chrome_elf_init.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "base/test/test_reg_util_win.h" | 14 #include "base/test/test_reg_util_win.h" |
15 #include "chrome/common/chrome_version.h" | 15 #include "chrome/common/chrome_version.h" |
| 16 #include "chrome/install_static/install_util.h" |
16 #include "chrome_elf/chrome_elf_constants.h" | 17 #include "chrome_elf/chrome_elf_constants.h" |
17 #include "components/variations/entropy_provider.h" | 18 #include "components/variations/entropy_provider.h" |
18 #include "components/variations/variations_associated_data.h" | 19 #include "components/variations/variations_associated_data.h" |
19 #include "components/version_info/version_info.h" | 20 #include "components/version_info/version_info.h" |
20 #include "content/public/test/test_browser_thread_bundle.h" | 21 #include "content/public/test/test_browser_thread_bundle.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
22 | 23 |
23 namespace { | 24 namespace { |
24 | 25 |
25 class ChromeBlacklistTrialTest : public testing::Test { | 26 class ChromeBlacklistTrialTest : public testing::Test { |
26 protected: | 27 protected: |
27 ChromeBlacklistTrialTest() {} | 28 ChromeBlacklistTrialTest() {} |
28 ~ChromeBlacklistTrialTest() override {} | 29 ~ChromeBlacklistTrialTest() override {} |
29 | 30 |
30 void SetUp() override { | 31 void SetUp() override { |
31 testing::Test::SetUp(); | 32 testing::Test::SetUp(); |
32 | 33 |
33 ASSERT_NO_FATAL_FAILURE( | 34 ASSERT_NO_FATAL_FAILURE( |
34 override_manager_.OverrideRegistry(HKEY_CURRENT_USER)); | 35 override_manager_.OverrideRegistry(HKEY_CURRENT_USER)); |
35 | 36 |
36 blacklist_registry_key_.reset( | 37 blacklist_registry_key_.reset( |
37 new base::win::RegKey(HKEY_CURRENT_USER, | 38 new base::win::RegKey(HKEY_CURRENT_USER, |
38 blacklist::kRegistryBeaconPath, | 39 install_static::GetRegistryPath() |
| 40 .append(blacklist::kRegistryBeaconKeyName) |
| 41 .c_str(), |
39 KEY_QUERY_VALUE | KEY_SET_VALUE)); | 42 KEY_QUERY_VALUE | KEY_SET_VALUE)); |
40 } | 43 } |
41 | 44 |
42 DWORD GetBlacklistState() { | 45 DWORD GetBlacklistState() { |
43 DWORD blacklist_state = blacklist::BLACKLIST_STATE_MAX; | 46 DWORD blacklist_state = blacklist::BLACKLIST_STATE_MAX; |
44 blacklist_registry_key_->ReadValueDW(blacklist::kBeaconState, | 47 blacklist_registry_key_->ReadValueDW(blacklist::kBeaconState, |
45 &blacklist_state); | 48 &blacklist_state); |
46 | 49 |
47 return blacklist_state; | 50 return blacklist_state; |
48 } | 51 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 ASSERT_EQ(expected_version, GetBlacklistVersion()); | 153 ASSERT_EQ(expected_version, GetBlacklistVersion()); |
151 | 154 |
152 // The counter should be reset. | 155 // The counter should be reset. |
153 DWORD attempt_count = blacklist::kBeaconMaxAttempts; | 156 DWORD attempt_count = blacklist::kBeaconMaxAttempts; |
154 blacklist_registry_key_->ReadValueDW(blacklist::kBeaconAttemptCount, | 157 blacklist_registry_key_->ReadValueDW(blacklist::kBeaconAttemptCount, |
155 &attempt_count); | 158 &attempt_count); |
156 ASSERT_EQ(static_cast<DWORD>(0), attempt_count); | 159 ASSERT_EQ(static_cast<DWORD>(0), attempt_count); |
157 } | 160 } |
158 | 161 |
159 } // namespace | 162 } // namespace |
OLD | NEW |