OLD | NEW |
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/profile_resetter/triggered_profile_resetter.h" | 5 #include "chrome/browser/profile_resetter/triggered_profile_resetter.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
12 #include "base/test/test_reg_util_win.h" | 12 #include "base/test/test_reg_util_win.h" |
13 #include "base/win/registry.h" | 13 #include "base/win/registry.h" |
14 #include "chrome/browser/prefs/browser_prefs.h" | 14 #include "chrome/browser/prefs/browser_prefs.h" |
15 #include "chrome/browser/profile_resetter/triggered_profile_resetter_factory.h" | 15 #include "chrome/browser/profile_resetter/triggered_profile_resetter_factory.h" |
16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
17 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
18 #include "components/variations/entropy_provider.h" | 18 #include "components/variations/entropy_provider.h" |
19 #include "content/public/test/test_browser_thread_bundle.h" | 19 #include "content/public/test/test_browser_thread_bundle.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
21 | 21 |
22 using base::win::RegKey; | 22 using base::win::RegKey; |
23 | 23 |
24 class TriggeredProfileResetterTest : public testing::Test { | 24 class TriggeredProfileResetterTest : public testing::Test { |
25 protected: | 25 protected: |
26 void SetUp() { | 26 void SetUp() override { |
27 override_manager_.OverrideRegistry(HKEY_CURRENT_USER); | 27 override_manager_.OverrideRegistry(HKEY_CURRENT_USER); |
28 | 28 |
29 // Activate the triggered reset field trial for these tests. | 29 // Activate the triggered reset field trial for these tests. |
30 field_trial_list_.reset( | 30 field_trial_list_.reset( |
31 new base::FieldTrialList(new metrics::SHA1EntropyProvider("foo"))); | 31 new base::FieldTrialList(new metrics::SHA1EntropyProvider("foo"))); |
32 base::FieldTrial* trial = base::FieldTrialList::CreateFieldTrial( | 32 base::FieldTrial* trial = base::FieldTrialList::CreateFieldTrial( |
33 "TriggeredResetFieldTrial", "On"); | 33 "TriggeredResetFieldTrial", "On"); |
34 trial->group(); | 34 trial->group(); |
35 } | 35 } |
36 | 36 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 const wchar_t kExpectedToolName[] = | 95 const wchar_t kExpectedToolName[] = |
96 L"ToolMcToolToolMcToolToolMcToolToolMcToolToolMcToolToolMcToolToolMcTool" | 96 L"ToolMcToolToolMcToolToolMcToolToolMcToolToolMcToolToolMcToolToolMcTool" |
97 L"ToolMcToolToolMcToolToolMcTool"; | 97 L"ToolMcToolToolMcToolToolMcTool"; |
98 SetRegTimestampAndToolName(kLongToolName, nullptr); | 98 SetRegTimestampAndToolName(kLongToolName, nullptr); |
99 TriggeredProfileResetter triggered_profile_resetter(&profile_); | 99 TriggeredProfileResetter triggered_profile_resetter(&profile_); |
100 triggered_profile_resetter.Activate(); | 100 triggered_profile_resetter.Activate(); |
101 EXPECT_TRUE(triggered_profile_resetter.HasResetTrigger()); | 101 EXPECT_TRUE(triggered_profile_resetter.HasResetTrigger()); |
102 EXPECT_STREQ(kExpectedToolName, | 102 EXPECT_STREQ(kExpectedToolName, |
103 triggered_profile_resetter.GetResetToolName().c_str()); | 103 triggered_profile_resetter.GetResetToolName().c_str()); |
104 } | 104 } |
OLD | NEW |