Chromium Code Reviews| 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 "base/metrics/field_trial.h" | 5 #include "base/metrics/field_trial.h" |
| 6 | 6 |
| 7 #if defined(OS_ANDROID) | 7 #if defined(OS_ANDROID) |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 // On iOS it is not technically possible to prep the field trials on first | 36 // On iOS it is not technically possible to prep the field trials on first |
| 37 // launch, the configuration file is downloaded too late. In order to run some | 37 // launch, the configuration file is downloaded too late. In order to run some |
| 38 // experiments that need to be active on first launch to be meaningful these | 38 // experiments that need to be active on first launch to be meaningful these |
| 39 // are hardcoded, but can be superceeded by a server side config on subsequent | 39 // are hardcoded, but can be superceeded by a server side config on subsequent |
| 40 // launches. | 40 // launches. |
| 41 void SetUpFirstLaunchFieldTrial(bool is_stable_channel) { | 41 void SetUpFirstLaunchFieldTrial(bool is_stable_channel) { |
| 42 // Check first if a server side config superceeded this experiment. | 42 // Check first if a server side config superceeded this experiment. |
| 43 if (base::FieldTrialList::TrialExists(kPopularSitesFieldTrialName)) | 43 if (base::FieldTrialList::TrialExists(kPopularSitesFieldTrialName)) |
| 44 return; | 44 return; |
| 45 | 45 |
| 46 // The experiment is only for stable. | |
|
sfiera
2017/02/03 14:02:34
I wouldn't describe this as an experiment anymore
noyau (Ping after 24h)
2017/02/21 12:24:16
It's an experiment to keep 10% disabled :)
| |
| 47 if (!is_stable_channel) | |
|
rkaplow
2017/02/07 03:56:46
maybe also comment on intended behavior of other c
noyau (Ping after 24h)
2017/02/21 12:24:16
Done.
| |
| 48 return; | |
| 49 | |
| 46 // Stable channels will run with 10% probability. | 50 // Stable channels will run with 10% probability. |
| 47 // Non-stable channels will run with 50% probability. | |
| 48 const base::FieldTrial::Probability kTotalProbability = 100; | 51 const base::FieldTrial::Probability kTotalProbability = 100; |
| 49 const base::FieldTrial::Probability kEnabledAndControlProbability = | 52 const base::FieldTrial::Probability kEnabledAndControlProbability = 10; |
| 50 is_stable_channel ? 10 : 50; | |
| 51 | 53 |
| 52 // Experiment enabled until March 15, 2017. By default, disabled. | 54 // Experiment enabled until April 26, 2017. |
| 53 scoped_refptr<base::FieldTrial> trial( | 55 scoped_refptr<base::FieldTrial> trial( |
| 54 base::FieldTrialList::FactoryGetFieldTrial( | 56 base::FieldTrialList::FactoryGetFieldTrial( |
| 55 kPopularSitesFieldTrialName, kTotalProbability, | 57 kPopularSitesFieldTrialName, kTotalProbability, |
| 56 kPopularSiteDefaultGroup, 2017, 3, 15, // Mar 15, 2017 | 58 kPopularSiteDefaultGroup, 2017, 4, 26, // Apr 26, 2017 |
| 57 base::FieldTrial::ONE_TIME_RANDOMIZED, nullptr)); | 59 base::FieldTrial::ONE_TIME_RANDOMIZED, nullptr)); |
| 58 | 60 |
| 59 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 61 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 60 if (command_line->HasSwitch(ntp_tiles::switches::kEnableNTPPopularSites)) { | 62 if (command_line->HasSwitch(ntp_tiles::switches::kEnableNTPPopularSites)) { |
| 61 trial->AppendGroup(kPopularSiteEnabledCommandLineSwitchGroup, | 63 trial->AppendGroup(kPopularSiteEnabledCommandLineSwitchGroup, |
| 62 kTotalProbability); | 64 kTotalProbability); |
| 63 } else if (command_line->HasSwitch( | 65 } else if (command_line->HasSwitch( |
| 64 ntp_tiles::switches::kDisableNTPPopularSites)) { | 66 ntp_tiles::switches::kDisableNTPPopularSites)) { |
| 65 trial->AppendGroup(kPopularSiteDisabledCommandLineSwitchGroup, | 67 trial->AppendGroup(kPopularSiteDisabledCommandLineSwitchGroup, |
| 66 kTotalProbability); | 68 kTotalProbability); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 89 if (cmd_line->HasSwitch(switches::kEnableNTPPopularSites)) | 91 if (cmd_line->HasSwitch(switches::kEnableNTPPopularSites)) |
| 90 return true; | 92 return true; |
| 91 | 93 |
| 92 #if defined(OS_ANDROID) | 94 #if defined(OS_ANDROID) |
| 93 if (Java_MostVisitedSites_isPopularSitesForceEnabled( | 95 if (Java_MostVisitedSites_isPopularSitesForceEnabled( |
| 94 base::android::AttachCurrentThread())) { | 96 base::android::AttachCurrentThread())) { |
| 95 return true; | 97 return true; |
| 96 } | 98 } |
| 97 #endif | 99 #endif |
| 98 | 100 |
| 99 return base::StartsWith(group_name, "Enabled", | 101 // The experiment is enabled by default. |
|
sfiera
2017/02/03 14:02:34
This should be restricted to iOS.
noyau (Ping after 24h)
2017/02/21 12:24:16
Done.
But is this really true? Does that mean tha
sfiera
2017/02/21 13:10:21
Nope. We still don't have launch approval for all
| |
| 102 return group_name.empty() || (group_name == kPopularSiteDefaultGroup) || | |
| 103 base::StartsWith(group_name, "Enabled", | |
| 100 base::CompareCase::INSENSITIVE_ASCII); | 104 base::CompareCase::INSENSITIVE_ASCII); |
| 101 } | 105 } |
| 102 | 106 |
| 103 } // namespace ntp_tiles | 107 } // namespace ntp_tiles |
| OLD | NEW |