Chromium Code Reviews| 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..1c7234717888c2697869285fe4ee67c46dc5a37d |
| --- /dev/null |
| +++ b/chrome/browser/policy/policy_network_browsertest.cc |
| @@ -0,0 +1,48 @@ |
| +// 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 QuicEnabledPolicyTest: public InProcessBrowserTest { |
| +public: |
| + QuicEnabledPolicyTest() : 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::kQuicEnabled, |
| + policy::POLICY_LEVEL_MANDATORY, |
| + policy::POLICY_SCOPE_MACHINE, |
| + new base::FundamentalValue(false), |
| + NULL); |
| + provider_.UpdateChromePolicy(values); |
| + |
| + } |
| + private: |
| + policy::MockConfigurationPolicyProvider provider_; |
| + DISALLOW_COPY_AND_ASSIGN(QuicEnabledPolicyTest); |
| +}; |
| + |
| +IN_PROC_BROWSER_TEST_F(QuicEnabledPolicyTest, 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); |
|
Andrew T Wilson (Slow)
2015/03/12 17:23:34
Good test, but would be good to test the reverse c
peletskyi
2015/03/13 12:00:40
From my point of view this test is enough. We wish
|
| +} |