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 <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 base::FieldTrialList::CreateFieldTrial(kClientLoFiFieldTrial, kEnabled)); | 159 base::FieldTrialList::CreateFieldTrial(kClientLoFiFieldTrial, kEnabled)); |
160 | 160 |
161 EXPECT_TRUE(params::IsClientLoFiEnabled()); | 161 EXPECT_TRUE(params::IsClientLoFiEnabled()); |
162 EXPECT_EQ(10, params::ClientLoFiVersion()); | 162 EXPECT_EQ(10, params::ClientLoFiVersion()); |
163 EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_3G, | 163 EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_3G, |
164 params::EffectiveConnectionTypeThresholdForClientLoFi()); | 164 params::EffectiveConnectionTypeThresholdForClientLoFi()); |
165 | 165 |
166 variations::testing::ClearAllVariationParams(); | 166 variations::testing::ClearAllVariationParams(); |
167 } | 167 } |
168 | 168 |
| 169 // Verifies that we can enable offline previews via comand line. |
| 170 TEST(PreviewsExperimentsTest, TestCommandLineClientLoFi) { |
| 171 EXPECT_FALSE(params::IsClientLoFiEnabled()); |
| 172 |
| 173 std::unique_ptr<base::FeatureList> feature_list = |
| 174 base::MakeUnique<base::FeatureList>(); |
| 175 |
| 176 // The feature is explicitly enabled on the command-line. |
| 177 feature_list->InitializeFromCommandLine("ClientLoFi", ""); |
| 178 base::FeatureList::ClearInstanceForTesting(); |
| 179 base::FeatureList::SetInstance(std::move(feature_list)); |
| 180 |
| 181 EXPECT_TRUE(params::IsClientLoFiEnabled()); |
| 182 base::FeatureList::ClearInstanceForTesting(); |
| 183 } |
| 184 |
169 } // namespace | 185 } // namespace |
170 | 186 |
171 } // namespace previews | 187 } // namespace previews |
OLD | NEW |