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

Side by Side Diff: chrome/browser/safe_browsing/incident_reporting/state_store_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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/state_store.h" 5 #include "chrome/browser/safe_browsing/incident_reporting/state_store.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/json/json_file_value_serializer.h" 10 #include "base/json/json_file_value_serializer.h"
(...skipping 28 matching lines...) Expand all
39 39
40 // A base test fixture that redirects HKCU for testing the platform state store 40 // A base test fixture that redirects HKCU for testing the platform state store
41 // backed by the Windows registry to prevent interference with existing Chrome 41 // backed by the Windows registry to prevent interference with existing Chrome
42 // installs or other tests. 42 // installs or other tests.
43 class PlatformStateStoreTestBase : public ::testing::Test { 43 class PlatformStateStoreTestBase : public ::testing::Test {
44 protected: 44 protected:
45 PlatformStateStoreTestBase() {} 45 PlatformStateStoreTestBase() {}
46 46
47 void SetUp() override { 47 void SetUp() override {
48 ::testing::Test::SetUp(); 48 ::testing::Test::SetUp();
49 registry_override_manager_.OverrideRegistry(HKEY_CURRENT_USER); 49 ASSERT_NO_FATAL_FAILURE(
50 registry_override_manager_.OverrideRegistry(HKEY_CURRENT_USER));
50 } 51 }
51 52
52 private: 53 private:
53 registry_util::RegistryOverrideManager registry_override_manager_; 54 registry_util::RegistryOverrideManager registry_override_manager_;
54 55
55 DISALLOW_COPY_AND_ASSIGN(PlatformStateStoreTestBase); 56 DISALLOW_COPY_AND_ASSIGN(PlatformStateStoreTestBase);
56 }; 57 };
57 58
58 #else // OS_WIN 59 #else // OS_WIN
59 60
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 // Verify that the state survived. 275 // Verify that the state survived.
275 ASSERT_TRUE(state_store.HasBeenReported(data.type, data.key, data.digest)); 276 ASSERT_TRUE(state_store.HasBeenReported(data.type, data.key, data.digest));
276 #else 277 #else
277 // Verify that the state did not survive. 278 // Verify that the state did not survive.
278 ASSERT_FALSE(state_store.HasBeenReported(data.type, data.key, data.digest)); 279 ASSERT_FALSE(state_store.HasBeenReported(data.type, data.key, data.digest));
279 #endif 280 #endif
280 } 281 }
281 } 282 }
282 283
283 } // namespace safe_browsing 284 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698