Index: chrome/browser/io_thread_unittest.cc |
diff --git a/chrome/browser/io_thread_unittest.cc b/chrome/browser/io_thread_unittest.cc |
index 5b60d6024d5bc37dc464f643ed69bcf551aeb07d..0523a618ed47758d64bfd79951c0b3303966cacd 100644 |
--- a/chrome/browser/io_thread_unittest.cc |
+++ b/chrome/browser/io_thread_unittest.cc |
@@ -3,7 +3,9 @@ |
// found in the LICENSE file. |
#include "base/command_line.h" |
+#include "base/metrics/field_trial.h" |
#include "chrome/browser/io_thread.h" |
+#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h" |
#include "net/http/http_network_session.h" |
#include "net/http/http_server_properties_impl.h" |
#include "net/quic/quic_protocol.h" |
@@ -14,6 +16,16 @@ namespace test { |
using ::testing::ElementsAre; |
+class BadEntropyProvider : public base::FieldTrial::EntropyProvider { |
+ public: |
+ ~BadEntropyProvider() override {} |
+ |
+ double GetEntropyForTrial(const std::string& trial_name, |
+ uint32 randomization_seed) const override { |
+ return 0.5; |
+ } |
+}; |
+ |
class IOThreadPeer { |
public: |
static void ConfigureQuicGlobals( |
@@ -114,6 +126,7 @@ TEST_F(IOThreadTest, DisableQuicByDefault) { |
net::HttpNetworkSession::Params params; |
InitializeNetworkSessionParams(¶ms); |
EXPECT_FALSE(params.enable_quic); |
+ EXPECT_FALSE(params.enable_quic_for_proxies); |
} |
TEST_F(IOThreadTest, EnableQuicFromFieldTrialGroup) { |
@@ -137,6 +150,19 @@ TEST_F(IOThreadTest, EnableQuicFromFieldTrialGroup) { |
EXPECT_FALSE(params.quic_enable_connection_racing); |
mmenke
2015/02/13 18:27:15
Should check params.enable_quic_for_proxies here (
|
} |
+TEST_F(IOThreadTest, EnableQuicFromQuicProxyFieldTrialGroup) { |
+ base::FieldTrialList field_trial_list(new BadEntropyProvider()); |
+ base::FieldTrialList::CreateFieldTrial( |
+ data_reduction_proxy::DataReductionProxyParams::GetQuicFieldTrialName(), |
+ "Enabled"); |
+ |
+ ConfigureQuicGlobals(); |
+ net::HttpNetworkSession::Params params; |
+ InitializeNetworkSessionParams(¶ms); |
+ EXPECT_FALSE(params.enable_quic); |
+ EXPECT_TRUE(params.enable_quic_for_proxies); |
mmenke
2015/02/13 17:45:21
Could you explain how this works? I really don't
tbansal1
2015/02/13 18:03:47
Constructor of FieldTrialList requires an entropy
mmenke
2015/02/13 18:09:44
Thanks for the explanation!
Worth having a test w
tbansal1
2015/02/13 19:54:29
Done.
|
+} |
+ |
TEST_F(IOThreadTest, EnableQuicFromCommandLine) { |
command_line_.AppendSwitch("enable-quic"); |