OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015 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 "base/command_line.h" |
| 6 #include "chrome/browser/browser_process.h" |
| 7 #include "chrome/test/base/in_process_browser_test.h" |
| 8 #include "components/policy/core/browser/browser_policy_connector.h" |
| 9 #include "components/policy/core/common/mock_configuration_policy_provider.h" |
| 10 #include "components/policy/core/common/policy_map.h" |
| 11 #include "content/public/test/browser_test.h" |
| 12 #include "net/http/http_transaction_factory.h" |
| 13 #include "net/url_request/url_request_context.h" |
| 14 #include "net/url_request/url_request_context_getter.h" |
| 15 #include "policy/policy_constants.h" |
| 16 |
| 17 class QuicAllowedPolicyTest: public InProcessBrowserTest { |
| 18 public: |
| 19 QuicAllowedPolicyTest() : InProcessBrowserTest(){} |
| 20 protected: |
| 21 void SetUpInProcessBrowserTestFixture() override { |
| 22 base::CommandLine::ForCurrentProcess()->AppendSwitch("enable-quic"); |
| 23 EXPECT_CALL(provider_, IsInitializationComplete(testing::_)) |
| 24 .WillRepeatedly(testing::Return(true)); |
| 25 |
| 26 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); |
| 27 |
| 28 policy::PolicyMap values; |
| 29 values.Set(policy::key::kQuicAllowed, |
| 30 policy::POLICY_LEVEL_MANDATORY, |
| 31 policy::POLICY_SCOPE_MACHINE, |
| 32 new base::FundamentalValue(false), |
| 33 NULL); |
| 34 provider_.UpdateChromePolicy(values); |
| 35 |
| 36 } |
| 37 private: |
| 38 policy::MockConfigurationPolicyProvider provider_; |
| 39 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyTest); |
| 40 }; |
| 41 |
| 42 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyTest, QuicDisabled) { |
| 43 net::URLRequestContext* context = |
| 44 g_browser_process->system_request_context()->GetURLRequestContext(); |
| 45 bool quic_enabled = context->http_transaction_factory()->GetSession()-> |
| 46 params().enable_quic; |
| 47 |
| 48 EXPECT_FALSE(quic_enabled); |
| 49 } |
OLD | NEW |