| 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/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
| 11 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/test/test_reg_util_win.h" | 14 #include "base/test/test_reg_util_win.h" |
| 14 #include "chrome/common/chrome_version.h" | 15 #include "chrome/common/chrome_version.h" |
| 15 #include "chrome_elf/chrome_elf_constants.h" | 16 #include "chrome_elf/chrome_elf_constants.h" |
| 16 #include "components/variations/entropy_provider.h" | 17 #include "components/variations/entropy_provider.h" |
| 17 #include "components/variations/variations_associated_data.h" | 18 #include "components/variations/variations_associated_data.h" |
| 18 #include "components/version_info/version_info.h" | 19 #include "components/version_info/version_info.h" |
| 19 #include "content/public/test/test_browser_thread_bundle.h" | 20 #include "content/public/test/test_browser_thread_bundle.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // Ensure that the blacklist is disabled for any users in the | 83 // Ensure that the blacklist is disabled for any users in the |
| 83 // "BlacklistDisabled" finch group. | 84 // "BlacklistDisabled" finch group. |
| 84 TEST_F(ChromeBlacklistTrialTest, BlacklistDisabledRun) { | 85 TEST_F(ChromeBlacklistTrialTest, BlacklistDisabledRun) { |
| 85 // Set the beacons to enabled values. | 86 // Set the beacons to enabled values. |
| 86 blacklist_registry_key_->WriteValue(blacklist::kBeaconState, | 87 blacklist_registry_key_->WriteValue(blacklist::kBeaconState, |
| 87 blacklist::BLACKLIST_ENABLED); | 88 blacklist::BLACKLIST_ENABLED); |
| 88 blacklist_registry_key_->WriteValue(blacklist::kBeaconVersion, L"Data"); | 89 blacklist_registry_key_->WriteValue(blacklist::kBeaconVersion, L"Data"); |
| 89 | 90 |
| 90 // Create the field trial with the blacklist disabled group. | 91 // Create the field trial with the blacklist disabled group. |
| 91 base::FieldTrialList field_trial_list( | 92 base::FieldTrialList field_trial_list( |
| 92 new metrics::SHA1EntropyProvider("test")); | 93 base::MakeUnique<metrics::SHA1EntropyProvider>("test")); |
| 93 | 94 |
| 94 scoped_refptr<base::FieldTrial> trial( | 95 scoped_refptr<base::FieldTrial> trial( |
| 95 base::FieldTrialList::CreateFieldTrial( | 96 base::FieldTrialList::CreateFieldTrial( |
| 96 kBrowserBlacklistTrialName, kBrowserBlacklistTrialDisabledGroupName)); | 97 kBrowserBlacklistTrialName, kBrowserBlacklistTrialDisabledGroupName)); |
| 97 | 98 |
| 98 // This setup code should now delete any existing blacklist beacons. | 99 // This setup code should now delete any existing blacklist beacons. |
| 99 InitializeChromeElf(); | 100 InitializeChromeElf(); |
| 100 | 101 |
| 101 // Ensure invalid values are returned to indicate that the beacon | 102 // Ensure invalid values are returned to indicate that the beacon |
| 102 // values are indeed gone. | 103 // values are indeed gone. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 ASSERT_EQ(expected_version, GetBlacklistVersion()); | 149 ASSERT_EQ(expected_version, GetBlacklistVersion()); |
| 149 | 150 |
| 150 // The counter should be reset. | 151 // The counter should be reset. |
| 151 DWORD attempt_count = blacklist::kBeaconMaxAttempts; | 152 DWORD attempt_count = blacklist::kBeaconMaxAttempts; |
| 152 blacklist_registry_key_->ReadValueDW(blacklist::kBeaconAttemptCount, | 153 blacklist_registry_key_->ReadValueDW(blacklist::kBeaconAttemptCount, |
| 153 &attempt_count); | 154 &attempt_count); |
| 154 ASSERT_EQ(static_cast<DWORD>(0), attempt_count); | 155 ASSERT_EQ(static_cast<DWORD>(0), attempt_count); |
| 155 } | 156 } |
| 156 | 157 |
| 157 } // namespace | 158 } // namespace |
| OLD | NEW |