Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Side by Side Diff: chrome/browser/safe_browsing/incident_reporting/environment_data_collection_win_unittest.cc

Issue 2692843002: Fail tests fast if overriding the Windows registry fails. (Closed)
Patch Set: sync to position 450085 Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/safe_browsing/incident_reporting/environment_data_colle ction_win.h" 5 #include "chrome/browser/safe_browsing/incident_reporting/environment_data_colle ction_win.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 EXPECT_EQ(std::string(kTestExportName), 176 EXPECT_EQ(std::string(kTestExportName),
177 process_report.module_state(0).modification(0).export_name()); 177 process_report.module_state(0).modification(0).export_name());
178 #endif 178 #endif
179 } 179 }
180 #endif // _WIN64 180 #endif // _WIN64
181 181
182 TEST(SafeBrowsingEnvironmentDataCollectionWinTest, CollectRegistryData) { 182 TEST(SafeBrowsingEnvironmentDataCollectionWinTest, CollectRegistryData) {
183 // Ensure that all values and subkeys from the specified registry keys are 183 // Ensure that all values and subkeys from the specified registry keys are
184 // correctly stored in the report. 184 // correctly stored in the report.
185 registry_util::RegistryOverrideManager override_manager; 185 registry_util::RegistryOverrideManager override_manager;
186 override_manager.OverrideRegistry(HKEY_CURRENT_USER); 186 ASSERT_NO_FATAL_FAILURE(override_manager.OverrideRegistry(HKEY_CURRENT_USER));
187 187
188 const wchar_t kRootKey[] = L"Software\\TestKey"; 188 const wchar_t kRootKey[] = L"Software\\TestKey";
189 const RegistryKeyInfo kRegKeysToCollect[] = { 189 const RegistryKeyInfo kRegKeysToCollect[] = {
190 {HKEY_CURRENT_USER, kRootKey}, 190 {HKEY_CURRENT_USER, kRootKey},
191 }; 191 };
192 const wchar_t kSubKey[] = L"SubKey"; 192 const wchar_t kSubKey[] = L"SubKey";
193 193
194 // Check that if the key is not there, then the proto is left empty. 194 // Check that if the key is not there, then the proto is left empty.
195 google::protobuf::RepeatedPtrField< 195 google::protobuf::RepeatedPtrField<
196 ClientIncidentReport_EnvironmentData_OS_RegistryKey> registry_data_pb; 196 ClientIncidentReport_EnvironmentData_OS_RegistryKey> registry_data_pb;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 TEST(SafeBrowsingEnvironmentDataCollectionWinTest, 263 TEST(SafeBrowsingEnvironmentDataCollectionWinTest,
264 CollectDomainEnrollmentData) { 264 CollectDomainEnrollmentData) {
265 // The test may or may not be running on a domain-enrolled machine, so all we 265 // The test may or may not be running on a domain-enrolled machine, so all we
266 // can check is that some value is filled in. 266 // can check is that some value is filled in.
267 ClientIncidentReport_EnvironmentData_OS os_data; 267 ClientIncidentReport_EnvironmentData_OS os_data;
268 CollectDomainEnrollmentData(&os_data); 268 CollectDomainEnrollmentData(&os_data);
269 EXPECT_TRUE(os_data.has_is_enrolled_to_domain()); 269 EXPECT_TRUE(os_data.has_is_enrolled_to_domain());
270 } 270 }
271 271
272 } // namespace safe_browsing 272 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698