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/chrome_elf_init_win.h" | 5 #include "chrome/browser/chrome_elf_init_win.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 return blacklist_version; | 47 return blacklist_version; |
48 } | 48 } |
49 | 49 |
50 scoped_ptr<base::win::RegKey> blacklist_registry_key_; | 50 scoped_ptr<base::win::RegKey> blacklist_registry_key_; |
51 registry_util::RegistryOverrideManager override_manager_; | 51 registry_util::RegistryOverrideManager override_manager_; |
52 | 52 |
53 private: | 53 private: |
54 DISALLOW_COPY_AND_ASSIGN(ChromeBlacklistTrialTest); | 54 DISALLOW_COPY_AND_ASSIGN(ChromeBlacklistTrialTest); |
55 }; | 55 }; |
56 | 56 |
57 | 57 // Ensure that the default trial sets up the blacklist beacons. |
58 // Ensure that the default trial deletes any existing blacklist beacons. | |
59 TEST_F(ChromeBlacklistTrialTest, DefaultRun) { | 58 TEST_F(ChromeBlacklistTrialTest, DefaultRun) { |
60 // Set some dummy values as beacons. | 59 // Set some dummy values as beacons. |
61 blacklist_registry_key_->WriteValue(blacklist::kBeaconState, | 60 blacklist_registry_key_->WriteValue(blacklist::kBeaconState, |
62 blacklist::BLACKLIST_ENABLED); | 61 blacklist::BLACKLIST_ENABLED); |
csharp
2014/05/15 18:15:58
This value should be changed to disabled (so we kn
krstnmnlsn
2014/05/15 18:30:00
Done.
| |
63 blacklist_registry_key_->WriteValue(blacklist::kBeaconVersion, L"Data"); | 62 blacklist_registry_key_->WriteValue(blacklist::kBeaconVersion, L"Data"); |
64 | 63 |
65 // This setup code should result in the default group, which should remove | 64 // This setup code should result in the default group, which should have |
66 // all the beacon values. | 65 // all the beacon values set. |
csharp
2014/05/15 18:15:58
nit "all the beacon values set"-> "the blacklist s
krstnmnlsn
2014/05/15 18:30:00
Done.
| |
67 InitializeChromeElf(); | 66 InitializeChromeElf(); |
68 | 67 |
69 // Ensure that invalid values are returned to indicate that the | 68 // Ensure the beacon values are correct, indicating the |
70 // beacon values are gone. | 69 // blacklist beacon was setup. |
71 ASSERT_EQ(blacklist::BLACKLIST_STATE_MAX, GetBlacklistState()); | 70 ASSERT_EQ(blacklist::BLACKLIST_ENABLED, GetBlacklistState()); |
72 ASSERT_EQ(base::string16(), GetBlacklistVersion()); | 71 chrome::VersionInfo version_info; |
72 base::string16 version(base::UTF8ToUTF16(version_info.Version())); | |
73 ASSERT_EQ(version, GetBlacklistVersion()); | |
73 } | 74 } |
74 | 75 |
75 TEST_F(ChromeBlacklistTrialTest, VerifyFirstRun) { | 76 TEST_F(ChromeBlacklistTrialTest, VerifyFirstRun) { |
76 BrowserBlacklistBeaconSetup(); | 77 BrowserBlacklistBeaconSetup(); |
77 | 78 |
78 // Verify the state is properly set after the first run. | 79 // Verify the state is properly set after the first run. |
79 ASSERT_EQ(blacklist::BLACKLIST_ENABLED, GetBlacklistState()); | 80 ASSERT_EQ(blacklist::BLACKLIST_ENABLED, GetBlacklistState()); |
80 | 81 |
81 chrome::VersionInfo version_info; | 82 chrome::VersionInfo version_info; |
82 base::string16 version(base::UTF8ToUTF16(version_info.Version())); | 83 base::string16 version(base::UTF8ToUTF16(version_info.Version())); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 | 136 |
136 BrowserBlacklistBeaconSetup(); | 137 BrowserBlacklistBeaconSetup(); |
137 | 138 |
138 // The beacon should now be marked as enabled for the current version. | 139 // The beacon should now be marked as enabled for the current version. |
139 ASSERT_EQ(blacklist::BLACKLIST_ENABLED, GetBlacklistState()); | 140 ASSERT_EQ(blacklist::BLACKLIST_ENABLED, GetBlacklistState()); |
140 | 141 |
141 chrome::VersionInfo version_info; | 142 chrome::VersionInfo version_info; |
142 base::string16 expected_version(base::UTF8ToUTF16(version_info.Version())); | 143 base::string16 expected_version(base::UTF8ToUTF16(version_info.Version())); |
143 ASSERT_EQ(expected_version, GetBlacklistVersion()); | 144 ASSERT_EQ(expected_version, GetBlacklistVersion()); |
144 } | 145 } |
OLD | NEW |