OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chrome_browser_field_trials.h" | 5 #include "chrome/browser/chrome_browser_field_trials.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
14 #include "base/sys_string_conversions.h" | 14 #include "base/sys_string_conversions.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "chrome/browser/auto_launch_trial.h" | 16 #include "chrome/browser/auto_launch_trial.h" |
17 #include "chrome/browser/autocomplete/autocomplete_field_trial.h" | 17 #include "chrome/browser/autocomplete/autocomplete_field_trial.h" |
18 #include "chrome/browser/extensions/default_apps_trial.h" | 18 #include "chrome/browser/extensions/default_apps_trial.h" |
19 #include "chrome/browser/google/google_util.h" | 19 #include "chrome/browser/google/google_util.h" |
20 #include "chrome/browser/gpu_util.h" | 20 #include "chrome/browser/gpu_util.h" |
21 #include "chrome/browser/net/predictor.h" | 21 #include "chrome/browser/net/predictor.h" |
22 #include "chrome/browser/prerender/prerender_field_trial.h" | 22 #include "chrome/browser/prerender/prerender_field_trial.h" |
23 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
24 #include "chrome/common/chrome_version_info.h" | 24 #include "chrome/common/chrome_version_info.h" |
25 #include "chrome/common/metrics/experiments_helper.h" | 25 #include "chrome/common/metrics/variations_util.h" |
26 #include "net/http/http_network_layer.h" | 26 #include "net/http/http_network_layer.h" |
27 #include "net/http/http_stream_factory.h" | 27 #include "net/http/http_stream_factory.h" |
28 #include "net/socket/client_socket_pool_base.h" | 28 #include "net/socket/client_socket_pool_base.h" |
29 #include "net/socket/client_socket_pool_manager.h" | 29 #include "net/socket/client_socket_pool_manager.h" |
30 #include "net/spdy/spdy_session.h" | 30 #include "net/spdy/spdy_session.h" |
31 #include "net/spdy/spdy_session_pool.h" | 31 #include "net/spdy/spdy_session_pool.h" |
32 #include "ui/base/layout.h" | 32 #include "ui/base/layout.h" |
33 | 33 |
34 #if defined(OS_WIN) | 34 #if defined(OS_WIN) |
35 #include "ui/base/win/dpi.h" // For DisableNewTabFieldTrialIfNecesssary. | 35 #include "ui/base/win/dpi.h" // For DisableNewTabFieldTrialIfNecesssary. |
(...skipping 21 matching lines...) Expand all Loading... |
57 const std::string trial_name = StringPrintf(trial_name_string.c_str(), | 57 const std::string trial_name = StringPrintf(trial_name_string.c_str(), |
58 group_percent); | 58 group_percent); |
59 | 59 |
60 DVLOG(1) << "Trial name = " << trial_name; | 60 DVLOG(1) << "Trial name = " << trial_name; |
61 | 61 |
62 scoped_refptr<base::FieldTrial> trial( | 62 scoped_refptr<base::FieldTrial> trial( |
63 base::FieldTrialList::FactoryGetFieldTrial( | 63 base::FieldTrialList::FactoryGetFieldTrial( |
64 trial_name, divisor, kDefaultGroupName, 2015, 1, 1, NULL)); | 64 trial_name, divisor, kDefaultGroupName, 2015, 1, 1, NULL)); |
65 if (one_time_randomized) | 65 if (one_time_randomized) |
66 trial->UseOneTimeRandomization(); | 66 trial->UseOneTimeRandomization(); |
67 experiments_helper::AssociateGoogleVariationID(trial_name, kDefaultGroupName, | 67 chrome_variations::AssociateGoogleVariationID(trial_name, kDefaultGroupName, |
68 trial_base_id); | 68 trial_base_id); |
69 // Loop starts with group 1 because the field trial automatically creates a | 69 // Loop starts with group 1 because the field trial automatically creates a |
70 // default group, which would be group 0. | 70 // default group, which would be group 0. |
71 for (int group_number = 1; group_number < num_trial_groups; ++group_number) { | 71 for (int group_number = 1; group_number < num_trial_groups; ++group_number) { |
72 const std::string group_name = StringPrintf("group_%02d", group_number); | 72 const std::string group_name = StringPrintf("group_%02d", group_number); |
73 DVLOG(1) << " Group name = " << group_name; | 73 DVLOG(1) << " Group name = " << group_name; |
74 trial->AppendGroup(group_name, kProbabilityPerGroup); | 74 trial->AppendGroup(group_name, kProbabilityPerGroup); |
75 experiments_helper::AssociateGoogleVariationID(trial_name, group_name, | 75 chrome_variations::AssociateGoogleVariationID(trial_name, group_name, |
76 static_cast<chrome_variations::VariationID>(trial_base_id + | 76 static_cast<chrome_variations::VariationID>(trial_base_id + |
77 group_number)); | 77 group_number)); |
78 } | 78 } |
79 | 79 |
80 // Now that all groups have been appended, call group() on the trial to | 80 // Now that all groups have been appended, call group() on the trial to |
81 // ensure that our trial is registered. This resolves an off-by-one issue | 81 // ensure that our trial is registered. This resolves an off-by-one issue |
82 // where the default group never gets chosen if we don't "use" the trial. | 82 // where the default group never gets chosen if we don't "use" the trial. |
83 const int chosen_group = trial->group(); | 83 const int chosen_group = trial->group(); |
84 DVLOG(1) << "Chosen Group: " << chosen_group; | 84 DVLOG(1) << "Chosen Group: " << chosen_group; |
85 } | 85 } |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 const base::FieldTrial::Probability kEnableProbability = 10; | 595 const base::FieldTrial::Probability kEnableProbability = 10; |
596 scoped_refptr<base::FieldTrial> trial = | 596 scoped_refptr<base::FieldTrial> trial = |
597 base::FieldTrialList::FactoryGetFieldTrial( | 597 base::FieldTrialList::FactoryGetFieldTrial( |
598 "ChannelID", kDivisor, "disable", 2012, 8, 23, NULL); | 598 "ChannelID", kDivisor, "disable", 2012, 8, 23, NULL); |
599 trial->UseOneTimeRandomization(); | 599 trial->UseOneTimeRandomization(); |
600 int enable_group = trial->AppendGroup("enable", kEnableProbability); | 600 int enable_group = trial->AppendGroup("enable", kEnableProbability); |
601 if (trial->group() == enable_group) | 601 if (trial->group() == enable_group) |
602 net::SSLConfigService::EnableChannelIDTrial(); | 602 net::SSLConfigService::EnableChannelIDTrial(); |
603 } | 603 } |
604 } | 604 } |
OLD | NEW |