| 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 "components/previews/core/previews_experiments.h" | 5 #include "components/previews/core/previews_experiments.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 EXPECT_EQ(effective_connection_type, | 138 EXPECT_EQ(effective_connection_type, |
| 139 params::EffectiveConnectionTypeThreshold()); | 139 params::EffectiveConnectionTypeThreshold()); |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace | 143 } // namespace |
| 144 | 144 |
| 145 // Verifies that we can enable offline previews via field trial. | 145 // Verifies that we can enable offline previews via field trial. |
| 146 TEST_F(PreviewsExperimentsTest, TestFieldTrialOfflinePage) { | 146 TEST_F(PreviewsExperimentsTest, TestFieldTrialOfflinePage) { |
| 147 EXPECT_FALSE(IsIncludedInClientSidePreviewsExperimentsFieldTrial()); | 147 EXPECT_FALSE(IsIncludedInClientSidePreviewsExperimentsFieldTrial()); |
| 148 EXPECT_FALSE(IsPreviewsTypeEnabled(PreviewsType::OFFLINE)); | 148 EXPECT_FALSE(params::IsOfflinePreviewsEnabled()); |
| 149 | 149 |
| 150 base::FieldTrialList field_trial_list(nullptr); | 150 base::FieldTrialList field_trial_list(nullptr); |
| 151 ASSERT_TRUE(EnableOfflinePreviewsForTesting()); | 151 ASSERT_TRUE(EnableOfflinePreviewsForTesting()); |
| 152 | 152 |
| 153 EXPECT_TRUE(IsIncludedInClientSidePreviewsExperimentsFieldTrial()); | 153 EXPECT_TRUE(IsIncludedInClientSidePreviewsExperimentsFieldTrial()); |
| 154 EXPECT_TRUE(IsPreviewsTypeEnabled(PreviewsType::OFFLINE)); | 154 EXPECT_TRUE(params::IsOfflinePreviewsEnabled()); |
| 155 variations::testing::ClearAllVariationParams(); | 155 variations::testing::ClearAllVariationParams(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 // Verifies that we can enable offline previews via field trial and that the | 158 // Verifies that we can enable offline previews via field trial and that the |
| 159 // default params for previews field trials are accurate. | 159 // default params for previews field trials are accurate. |
| 160 TEST_F(PreviewsExperimentsTest, TestAllDefaultParams) { | 160 TEST_F(PreviewsExperimentsTest, TestAllDefaultParams) { |
| 161 VerifyDefaultParams(); | 161 VerifyDefaultParams(); |
| 162 base::FieldTrialList field_trial_list(nullptr); | 162 base::FieldTrialList field_trial_list(nullptr); |
| 163 EXPECT_TRUE(variations::AssociateVariationParams( | 163 EXPECT_TRUE(variations::AssociateVariationParams( |
| 164 "ClientSidePreviews", "Enabled", GetFieldTrialParams())); | 164 "ClientSidePreviews", "Enabled", GetFieldTrialParams())); |
| 165 EXPECT_TRUE( | 165 EXPECT_TRUE( |
| 166 base::FieldTrialList::CreateFieldTrial("ClientSidePreviews", "Enabled")); | 166 base::FieldTrialList::CreateFieldTrial("ClientSidePreviews", "Enabled")); |
| 167 VerifyNewParams(); | 167 VerifyNewParams(); |
| 168 variations::testing::ClearAllVariationParams(); | 168 variations::testing::ClearAllVariationParams(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace previews | 171 } // namespace previews |
| OLD | NEW |