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/bind.h" | |
6 #include "base/command_line.h" | |
7 #include "base/memory/ref_counted.h" | |
8 #include "base/run_loop.h" | |
9 #include "chrome/browser/browser_process.h" | |
10 #include "chrome/test/base/in_process_browser_test.h" | |
11 #include "components/policy/core/browser/browser_policy_connector.h" | |
12 #include "components/policy/core/common/mock_configuration_policy_provider.h" | |
13 #include "components/policy/core/common/policy_map.h" | |
14 #include "content/public/browser/browser_thread.h" | |
15 #include "content/public/test/browser_test.h" | |
16 #include "net/http/http_transaction_factory.h" | |
17 #include "net/url_request/url_request_context.h" | |
18 #include "net/url_request/url_request_context_getter.h" | |
19 #include "policy/policy_constants.h" | |
20 | |
21 namespace { | |
22 | |
23 void getContext(net::URLRequestContextGetter* getter, | |
Andrew T Wilson (Slow)
2015/04/09 09:02:04
nit: getContext->GetContext
peletskyi
2015/04/09 09:43:33
Done.
| |
24 const base::Closure& done_callback) { | |
Andrew T Wilson (Slow)
2015/04/09 09:02:04
Should be indented to match the open paren above.
peletskyi
2015/04/09 09:43:33
Done.
| |
25 net::URLRequestContext* context = getter->GetURLRequestContext(); | |
26 bool quic_enabled = context->http_transaction_factory()->GetSession()-> | |
27 params().enable_quic; | |
28 EXPECT_FALSE(quic_enabled); | |
29 | |
30 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | |
31 done_callback); | |
32 } | |
33 | |
34 } // namespace | |
35 | |
Andrew T Wilson (Slow)
2015/04/09 09:02:04
Should probably put this stuff in namespace policy
peletskyi
2015/04/09 09:43:33
Done.
| |
36 class QuicAllowedPolicyTest: public InProcessBrowserTest { | |
37 public: | |
Andrew T Wilson (Slow)
2015/04/09 09:02:04
indent this
peletskyi
2015/04/09 09:43:33
Done.
| |
38 QuicAllowedPolicyTest() : InProcessBrowserTest(){} | |
39 protected: | |
Andrew T Wilson (Slow)
2015/04/09 09:02:04
blank line before protected:
peletskyi
2015/04/09 09:43:33
Done.
| |
40 void SetUpInProcessBrowserTestFixture() override { | |
41 base::CommandLine::ForCurrentProcess()->AppendSwitch("enable-quic"); | |
42 EXPECT_CALL(provider_, IsInitializationComplete(testing::_)) | |
43 .WillRepeatedly(testing::Return(true)); | |
44 | |
45 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); | |
46 | |
47 policy::PolicyMap values; | |
48 values.Set(policy::key::kQuicAllowed, | |
49 policy::POLICY_LEVEL_MANDATORY, | |
50 policy::POLICY_SCOPE_MACHINE, | |
51 new base::FundamentalValue(false), | |
52 NULL); | |
53 provider_.UpdateChromePolicy(values); | |
54 | |
55 } | |
56 | |
57 private: | |
58 policy::MockConfigurationPolicyProvider provider_; | |
59 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyTest); | |
60 }; | |
61 | |
62 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyTest, QuicDisabled) { | |
63 base::RunLoop run_loop; | |
64 content::BrowserThread::PostTask( | |
65 content::BrowserThread::IO, | |
66 FROM_HERE, | |
67 base::Bind(getContext, | |
Andrew T Wilson (Slow)
2015/04/09 09:02:04
Maybe rename getContext to VerifyQuicEnabledStatus
peletskyi
2015/04/09 09:43:33
Rename - done.
About three tests. I think it is be
Andrew T Wilson (Slow)
2015/04/09 12:13:15
OK, let's imagine someone goes into io_thread.cc l
peletskyi
2015/04/10 08:26:33
Acknowledged.
| |
68 make_scoped_refptr(g_browser_process->system_request_context()), | |
69 run_loop.QuitClosure())); | |
70 run_loop.Run(); | |
71 } | |
OLD | NEW |