Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Side by Side Diff: components/previews/core/previews_experiments.cc

Issue 2433793003: Generalize Previews Type code (Closed)
Patch Set: typo Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 bool IsIncludedInClientSidePreviewsExperimentsFieldTrial() { 104 bool IsIncludedInClientSidePreviewsExperimentsFieldTrial() {
105 // By convention, an experiment in the client-side previews study enables use 105 // By convention, an experiment in the client-side previews study enables use
106 // of at least one client-side previews optimization if its name begins with 106 // of at least one client-side previews optimization if its name begins with
107 // "Enabled." 107 // "Enabled."
108 return base::StartsWith( 108 return base::StartsWith(
109 base::FieldTrialList::FindFullName(kClientSidePreviewsFieldTrial), 109 base::FieldTrialList::FindFullName(kClientSidePreviewsFieldTrial),
110 kEnabled, base::CompareCase::SENSITIVE); 110 kEnabled, base::CompareCase::SENSITIVE);
111 } 111 }
112 112
113 bool IsOfflinePreviewsEnabled() { 113 bool IsPreviewsTypeEnabled(PreviewsType type) {
114 return ParamValue(kOfflinePagesSlowNetwork) == kExperimentEnabled; 114 switch (type) {
115 case PreviewsType::OFFLINE:
116 return ParamValue(kOfflinePagesSlowNetwork) == kExperimentEnabled;
117 default:
118 return false;
tbansal1 2016/10/21 16:17:19 Add NOTREACHED() in default?
119 }
115 } 120 }
116 121
117 bool EnableOfflinePreviewsForTesting() { 122 bool EnableOfflinePreviewsForTesting() {
118 std::map<std::string, std::string> params; 123 std::map<std::string, std::string> params;
119 params[kOfflinePagesSlowNetwork] = kExperimentEnabled; 124 params[kOfflinePagesSlowNetwork] = kExperimentEnabled;
120 return variations::AssociateVariationParams(kClientSidePreviewsFieldTrial, 125 return variations::AssociateVariationParams(kClientSidePreviewsFieldTrial,
121 kEnabled, params) && 126 kEnabled, params) &&
122 base::FieldTrialList::CreateFieldTrial(kClientSidePreviewsFieldTrial, 127 base::FieldTrialList::CreateFieldTrial(kClientSidePreviewsFieldTrial,
123 kEnabled); 128 kEnabled);
124 } 129 }
125 130
126 } // namespace previews 131 } // namespace previews
OLDNEW
« no previous file with comments | « components/previews/core/previews_experiments.h ('k') | components/previews/core/previews_experiments_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698