Index: chrome/browser/policy/policy_network_browsertest.cc |
diff --git a/chrome/browser/policy/policy_network_browsertest.cc b/chrome/browser/policy/policy_network_browsertest.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..69b2062c1907ebbb5710da321ba80fd4bfa0b03c |
--- /dev/null |
+++ b/chrome/browser/policy/policy_network_browsertest.cc |
@@ -0,0 +1,49 @@ |
+// Copyright (c) 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "base/command_line.h" |
+#include "chrome/browser/browser_process.h" |
+#include "chrome/test/base/in_process_browser_test.h" |
+#include "components/policy/core/browser/browser_policy_connector.h" |
+#include "components/policy/core/common/mock_configuration_policy_provider.h" |
+#include "components/policy/core/common/policy_map.h" |
+#include "content/public/test/browser_test.h" |
+#include "net/http/http_transaction_factory.h" |
+#include "net/url_request/url_request_context.h" |
+#include "net/url_request/url_request_context_getter.h" |
+#include "policy/policy_constants.h" |
+ |
+class QuicAllowedPolicyTest: public InProcessBrowserTest { |
+public: |
+ QuicAllowedPolicyTest() : InProcessBrowserTest(){} |
+ protected: |
+ void SetUpInProcessBrowserTestFixture() override { |
+ base::CommandLine::ForCurrentProcess()->AppendSwitch("enable-quic"); |
+ EXPECT_CALL(provider_, IsInitializationComplete(testing::_)) |
+ .WillRepeatedly(testing::Return(true)); |
+ |
+ policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); |
+ |
+ policy::PolicyMap values; |
+ values.Set(policy::key::kQuicAllowed, |
+ policy::POLICY_LEVEL_MANDATORY, |
+ policy::POLICY_SCOPE_MACHINE, |
+ new base::FundamentalValue(false), |
+ NULL); |
+ provider_.UpdateChromePolicy(values); |
+ |
+ } |
+ private: |
+ policy::MockConfigurationPolicyProvider provider_; |
+ DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyTest); |
+}; |
+ |
+IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyTest, QuicDisabled) { |
+ net::URLRequestContext* context = |
+ g_browser_process->system_request_context()->GetURLRequestContext(); |
+ bool quic_enabled = context->http_transaction_factory()->GetSession()-> |
+ params().enable_quic; |
+ |
+ EXPECT_FALSE(quic_enabled); |
+} |