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