Home | History | Annotate | Download | only in net
      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
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/net/async_dns_field_trial.h"
      6 
      7 #include "base/metrics/field_trial.h"
      8 #include "base/strings/string_util.h"
      9 #include "build/build_config.h"
     10 
     11 namespace chrome_browser_net {
     12 
     13 bool ConfigureAsyncDnsFieldTrial() {
     14 #if defined(OS_ANDROID) || defined(OS_IOS)
     15   // There is no DnsConfigService on those platforms so disable the field trial.
     16   return false;
     17 #endif
     18 
     19 #if defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_MACOSX)
     20   const bool kDefault = true;
     21 #else
     22   const bool kDefault = false;
     23 #endif
     24 
     25   // Configure the AsyncDns field trial as follows:
     26   // groups AsyncDnsA and AsyncDnsB: return true,
     27   // groups SystemDnsA and SystemDnsB: return false,
     28   // otherwise (trial absent): return default.
     29   std::string group_name = base::FieldTrialList::FindFullName("AsyncDns");
     30   if (!group_name.empty())
     31     return StartsWithASCII(group_name, "AsyncDns", false /* case_sensitive */);
     32   return kDefault;
     33 }
     34 
     35 }  // namespace chrome_browser_net
     36