| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chromeos/hats/hats_finch_helper.h" | 5 #include "chrome/browser/chromeos/hats/hats_finch_helper.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/test/scoped_feature_list.h" | 10 #include "base/test/scoped_feature_list.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 std::string reset) { | 50 std::string reset) { |
| 51 ParamMap params; | 51 ParamMap params; |
| 52 params[HatsFinchHelper::kProbabilityParam] = prob; | 52 params[HatsFinchHelper::kProbabilityParam] = prob; |
| 53 params[HatsFinchHelper::kSurveyCycleLengthParam] = cycle_length; | 53 params[HatsFinchHelper::kSurveyCycleLengthParam] = cycle_length; |
| 54 params[HatsFinchHelper::kSurveyStartDateMsParam] = start_date; | 54 params[HatsFinchHelper::kSurveyStartDateMsParam] = start_date; |
| 55 params[HatsFinchHelper::kResetSurveyCycleParam] = reset_survey; | 55 params[HatsFinchHelper::kResetSurveyCycleParam] = reset_survey; |
| 56 params[HatsFinchHelper::kResetAllParam] = reset; | 56 params[HatsFinchHelper::kResetAllParam] = reset; |
| 57 return params; | 57 return params; |
| 58 } | 58 } |
| 59 | 59 |
| 60 private: |
| 61 // Must outlive |profile_|. |
| 62 content::TestBrowserThreadBundle thread_bundle_; |
| 63 |
| 64 protected: |
| 60 TestingProfile profile_; | 65 TestingProfile profile_; |
| 61 | 66 |
| 62 private: | 67 private: |
| 63 variations::testing::VariationParamsManager params_manager_; | 68 variations::testing::VariationParamsManager params_manager_; |
| 64 content::TestBrowserThreadBundle thread_bundle_; | |
| 65 base::test::ScopedFeatureList scoped_feature_list_; | 69 base::test::ScopedFeatureList scoped_feature_list_; |
| 66 | 70 |
| 67 DISALLOW_COPY_AND_ASSIGN(HatsFinchHelperTest); | 71 DISALLOW_COPY_AND_ASSIGN(HatsFinchHelperTest); |
| 68 }; | 72 }; |
| 69 | 73 |
| 70 TEST_F(HatsFinchHelperTest, InitFinchSeed_ValidValues) { | 74 TEST_F(HatsFinchHelperTest, InitFinchSeed_ValidValues) { |
| 71 ParamMap params = | 75 ParamMap params = |
| 72 CreateParamMap("1.0", "7", "1475613895337", "false", "false"); | 76 CreateParamMap("1.0", "7", "1475613895337", "false", "false"); |
| 73 SetFinchSeedParams(params); | 77 SetFinchSeedParams(params); |
| 74 | 78 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 2 * current_time.ToJsTime()); | 172 2 * current_time.ToJsTime()); |
| 169 | 173 |
| 170 EXPECT_FALSE(pref_service->GetBoolean(prefs::kHatsDeviceIsSelected)); | 174 EXPECT_FALSE(pref_service->GetBoolean(prefs::kHatsDeviceIsSelected)); |
| 171 EXPECT_NE(pref_service->GetInt64(prefs::kHatsSurveyCycleEndTimestamp), | 175 EXPECT_NE(pref_service->GetInt64(prefs::kHatsSurveyCycleEndTimestamp), |
| 172 initial_timestamp); | 176 initial_timestamp); |
| 173 EXPECT_NE(pref_service->GetInt64(prefs::kHatsLastInteractionTimestamp), | 177 EXPECT_NE(pref_service->GetInt64(prefs::kHatsLastInteractionTimestamp), |
| 174 initial_timestamp); | 178 initial_timestamp); |
| 175 } | 179 } |
| 176 | 180 |
| 177 } // namespace chromeos | 181 } // namespace chromeos |
| OLD | NEW |