OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/settings_reset_prompt/settings_reset_prom
pt_config.h" | 5 #include "chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prom
pt_config.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 return { | 42 return { |
43 {"domain_hashes", base::StringPrintf("{\"%s\": \"1\"}", kDomainHash)}, | 43 {"domain_hashes", base::StringPrintf("{\"%s\": \"1\"}", kDomainHash)}, |
44 {"delay_before_prompt_seconds", "42"}, | 44 {"delay_before_prompt_seconds", "42"}, |
45 {"use_modal_dialog", "true"}}; | 45 {"use_modal_dialog", "true"}}; |
46 } | 46 } |
47 | 47 |
48 variations::testing::VariationParamsManager params_manager_; | 48 variations::testing::VariationParamsManager params_manager_; |
49 base::test::ScopedFeatureList scoped_feature_list_; | 49 base::test::ScopedFeatureList scoped_feature_list_; |
50 }; | 50 }; |
51 | 51 |
52 TEST_F(SettingsResetPromptConfigTest, IsPromptEnabled) { | |
53 EXPECT_FALSE(SettingsResetPromptConfig::IsPromptEnabled()); | |
54 | |
55 SetFeatureParams(GetDefaultFeatureParams()); | |
56 EXPECT_TRUE(SettingsResetPromptConfig::IsPromptEnabled()); | |
57 } | |
58 | |
59 TEST_F(SettingsResetPromptConfigTest, Create) { | 52 TEST_F(SettingsResetPromptConfigTest, Create) { |
60 ASSERT_FALSE(SettingsResetPromptConfig::IsPromptEnabled()); | 53 ASSERT_FALSE(SettingsResetPromptConfig::IsPromptEnabled()); |
61 | 54 |
62 // |Create()| should return nullptr when feature is not enabled. | 55 // |Create()| should return nullptr when feature is not enabled. |
63 EXPECT_FALSE(SettingsResetPromptConfig::Create()); | 56 EXPECT_FALSE(SettingsResetPromptConfig::Create()); |
64 | 57 |
65 // |Create()| should return false when feature is enabled, but parameters are | 58 // |Create()| should return false when feature is enabled, but parameters are |
66 // |missing. | 59 // |missing. |
67 scoped_feature_list_.InitAndEnableFeature(kSettingsResetPrompt); | 60 scoped_feature_list_.InitAndEnableFeature(kSettingsResetPrompt); |
68 ASSERT_TRUE(SettingsResetPromptConfig::IsPromptEnabled()); | 61 ASSERT_TRUE(SettingsResetPromptConfig::IsPromptEnabled()); |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 params[kModalParam] = "false"; | 277 params[kModalParam] = "false"; |
285 SetFeatureParams(params); | 278 SetFeatureParams(params); |
286 { | 279 { |
287 auto config = SettingsResetPromptConfig::Create(); | 280 auto config = SettingsResetPromptConfig::Create(); |
288 ASSERT_TRUE(config); | 281 ASSERT_TRUE(config); |
289 EXPECT_FALSE(config->use_modal_dialog()); | 282 EXPECT_FALSE(config->use_modal_dialog()); |
290 } | 283 } |
291 } | 284 } |
292 | 285 |
293 } // namespace safe_browsing | 286 } // namespace safe_browsing |
OLD | NEW |