1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "chrome/browser/chrome_browser_field_trials_desktop.h"
6 
7 #include <map>
8 #include <string>
9 
10 #include "base/command_line.h"
11 #include "base/feature_list.h"
12 #include "base/metrics/field_trial.h"
13 #include "base/metrics/field_trial_params.h"
14 #include "chrome/common/chrome_paths.h"
15 #include "chrome/common/chrome_switches.h"
16 #include "components/metrics/persistent_system_profile.h"
17 #include "components/variations/variations_associated_data.h"
18 #include "content/public/common/content_switches.h"
19 
20 namespace chrome {
21 
22 namespace {
23 
SetupStunProbeTrial()24 void SetupStunProbeTrial() {
25   std::map<std::string, std::string> params;
26   if (!variations::GetVariationParams("StunProbeTrial2", &params))
27     return;
28 
29   // The parameter, used by StartStunFieldTrial, should have the following
30   // format: "request_per_ip/interval/sharedsocket/batch_size/total_batches/
31   // server1:port/server2:port/server3:port/"
32   std::string cmd_param = params["request_per_ip"] + "/" + params["interval"] +
33                           "/" + params["sharedsocket"] + "/" +
34                           params["batch_size"] + "/" + params["total_batches"] +
35                           "/" + params["server1"] + "/" + params["server2"] +
36                           "/" + params["server3"] + "/" + params["server4"] +
37                           "/" + params["server5"] + "/" + params["server6"];
38 
39   base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
40       switches::kWebRtcStunProbeTrialParameter, cmd_param);
41 }
42 
43 }  // namespace
44 
SetupDesktopFieldTrials()45 void SetupDesktopFieldTrials() {
46   SetupStunProbeTrial();
47 }
48 
49 }  // namespace chrome
50