| 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/signin/cross_device_promo.h" | 5 #include "chrome/browser/signin/cross_device_promo.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 SigninManagerFactory::GetForProfile(profile())); | 157 SigninManagerFactory::GetForProfile(profile())); |
| 158 | 158 |
| 159 cross_device_promo_ = CrossDevicePromoFactory::GetForProfile(profile()); | 159 cross_device_promo_ = CrossDevicePromoFactory::GetForProfile(profile()); |
| 160 } | 160 } |
| 161 | 161 |
| 162 void CrossDevicePromoTest::ResetFieldTrialList() { | 162 void CrossDevicePromoTest::ResetFieldTrialList() { |
| 163 // Destroy the existing FieldTrialList before creating a new one to avoid | 163 // Destroy the existing FieldTrialList before creating a new one to avoid |
| 164 // a DCHECK. | 164 // a DCHECK. |
| 165 field_trial_list_.reset(); | 165 field_trial_list_.reset(); |
| 166 field_trial_list_.reset( | 166 field_trial_list_.reset( |
| 167 new base::FieldTrialList(new metrics::SHA1EntropyProvider("foo"))); | 167 new base::FieldTrialList( |
| 168 base::MakeUnique<metrics::SHA1EntropyProvider>("foo"))); |
| 168 variations::testing::ClearAllVariationParams(); | 169 variations::testing::ClearAllVariationParams(); |
| 169 } | 170 } |
| 170 | 171 |
| 171 void CrossDevicePromoTest::InitPromoVariation() { | 172 void CrossDevicePromoTest::InitPromoVariation() { |
| 172 VariationsMap variations_params; | 173 VariationsMap variations_params; |
| 173 variations_params[ | 174 variations_params[ |
| 174 CrossDevicePromo::kParamHoursBetweenDeviceActivityChecks] = "2"; | 175 CrossDevicePromo::kParamHoursBetweenDeviceActivityChecks] = "2"; |
| 175 variations_params[ | 176 variations_params[ |
| 176 CrossDevicePromo::kParamDaysToVerifySingleUserProfile] = "0"; | 177 CrossDevicePromo::kParamDaysToVerifySingleUserProfile] = "0"; |
| 177 variations_params[ | 178 variations_params[ |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 EXPECT_EQ(2, prefs()->GetInteger(prefs::kCrossDevicePromoNumDevices)); | 668 EXPECT_EQ(2, prefs()->GetInteger(prefs::kCrossDevicePromoNumDevices)); |
| 668 EXPECT_EQ(device2_last_active.ToInternalValue(), | 669 EXPECT_EQ(device2_last_active.ToInternalValue(), |
| 669 prefs()->GetInt64(prefs::kCrossDevicePromoLastDeviceActiveTime)); | 670 prefs()->GetInt64(prefs::kCrossDevicePromoLastDeviceActiveTime)); |
| 670 EXPECT_TRUE(prefs()->GetBoolean(prefs::kCrossDevicePromoShouldBeShown)); | 671 EXPECT_TRUE(prefs()->GetBoolean(prefs::kCrossDevicePromoShouldBeShown)); |
| 671 test_two_devices.ExpectUniqueSample("Signin.XDevicePromo.Eligibility", | 672 test_two_devices.ExpectUniqueSample("Signin.XDevicePromo.Eligibility", |
| 672 signin_metrics::ELIGIBLE, 1); | 673 signin_metrics::ELIGIBLE, 1); |
| 673 EXPECT_TRUE(observer.is_eligible()); | 674 EXPECT_TRUE(observer.is_eligible()); |
| 674 EXPECT_EQ(1, observer.times_set_eligible()); | 675 EXPECT_EQ(1, observer.times_set_eligible()); |
| 675 } | 676 } |
| 676 } | 677 } |
| OLD | NEW |