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

Side by Side Diff: chrome/browser/safe_browsing/incident_reporting/platform_state_store_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 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/platform_state_store.h " 5 #include "chrome/browser/safe_browsing/incident_reporting/platform_state_store.h "
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 24 matching lines...) Expand all
35 class PlatformStateStoreWinTest : public ::testing::Test { 35 class PlatformStateStoreWinTest : public ::testing::Test {
36 protected: 36 protected:
37 PlatformStateStoreWinTest() 37 PlatformStateStoreWinTest()
38 : profile_(nullptr), 38 : profile_(nullptr),
39 task_runner_(new base::TestSimpleTaskRunner()), 39 task_runner_(new base::TestSimpleTaskRunner()),
40 profile_manager_(TestingBrowserProcess::GetGlobal()) {} 40 profile_manager_(TestingBrowserProcess::GetGlobal()) {}
41 41
42 void SetUp() override { 42 void SetUp() override {
43 ::testing::Test::SetUp(); 43 ::testing::Test::SetUp();
44 base::MessageLoop::current()->SetTaskRunner(task_runner_); 44 base::MessageLoop::current()->SetTaskRunner(task_runner_);
45 registry_override_manager_.OverrideRegistry(HKEY_CURRENT_USER); 45 ASSERT_NO_FATAL_FAILURE(
46 registry_override_manager_.OverrideRegistry(HKEY_CURRENT_USER));
46 ASSERT_TRUE(profile_manager_.SetUp()); 47 ASSERT_TRUE(profile_manager_.SetUp());
47 } 48 }
48 49
49 // Creates/resets |profile_|. If |new_profile| is true, the profile will 50 // Creates/resets |profile_|. If |new_profile| is true, the profile will
50 // believe that it is new (Profile::IsNewProfile() will return true). 51 // believe that it is new (Profile::IsNewProfile() will return true).
51 void ResetProfile(bool new_profile) { 52 void ResetProfile(bool new_profile) {
52 if (profile_) { 53 if (profile_) {
53 profile_manager_.DeleteTestingProfile(kProfileName_); 54 profile_manager_.DeleteTestingProfile(kProfileName_);
54 profile_ = nullptr; 55 profile_ = nullptr;
55 } 56 }
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 176
176 std::string data; 177 std::string data;
177 PlatformStateStoreLoadResult result = ReadStoreData(profile_, &data); 178 PlatformStateStoreLoadResult result = ReadStoreData(profile_, &data);
178 EXPECT_EQ(PlatformStateStoreLoadResult::CLEARED_DATA, result); 179 EXPECT_EQ(PlatformStateStoreLoadResult::CLEARED_DATA, result);
179 EXPECT_EQ(std::string(), data); 180 EXPECT_EQ(std::string(), data);
180 AssertTestDataIsAbsent(); 181 AssertTestDataIsAbsent();
181 } 182 }
182 183
183 } // namespace platform_state_store 184 } // namespace platform_state_store
184 } // namespace safe_browsing 185 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698