OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 bool quic_enabled = context->http_transaction_factory()->GetSession()-> | 30 bool quic_enabled = context->http_transaction_factory()->GetSession()-> |
31 params().enable_quic; | 31 params().enable_quic; |
32 EXPECT_EQ(quic_enabled_expected, quic_enabled); | 32 EXPECT_EQ(quic_enabled_expected, quic_enabled); |
33 | 33 |
34 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 34 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
35 done_callback); | 35 done_callback); |
36 } | 36 } |
37 | 37 |
38 void VerifyQuicEnabledStatusInIOThread(bool quic_enabled_expected) { | 38 void VerifyQuicEnabledStatusInIOThread(bool quic_enabled_expected) { |
39 base::RunLoop run_loop; | 39 base::RunLoop run_loop; |
40 content::BrowserThread::PostTask( | 40 content::BrowserThread::PostTask( |
41 content::BrowserThread::IO, | 41 content::BrowserThread::IO, FROM_HERE, |
42 FROM_HERE, | 42 base::Bind(VerifyQuicEnabledStatus, |
43 base::Bind( | 43 base::RetainedRef(g_browser_process->system_request_context()), |
44 VerifyQuicEnabledStatus, | 44 quic_enabled_expected, run_loop.QuitClosure())); |
45 make_scoped_refptr(g_browser_process->system_request_context()), | 45 run_loop.Run(); |
46 quic_enabled_expected, | |
47 run_loop.QuitClosure())); | |
48 run_loop.Run(); | |
49 } | 46 } |
50 | 47 |
51 } // namespace | 48 } // namespace |
52 | 49 |
53 namespace policy { | 50 namespace policy { |
54 | 51 |
55 // The tests are based on the assumption that command line flag kEnableQuic | 52 // The tests are based on the assumption that command line flag kEnableQuic |
56 // guarantees that QUIC protocol is enabled which is the case at the moment | 53 // guarantees that QUIC protocol is enabled which is the case at the moment |
57 // when these are being written. | 54 // when these are being written. |
58 class QuicAllowedPolicyTestBase: public InProcessBrowserTest { | 55 class QuicAllowedPolicyTestBase: public InProcessBrowserTest { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 124 |
128 private: | 125 private: |
129 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsNotSet); | 126 DISALLOW_COPY_AND_ASSIGN(QuicAllowedPolicyIsNotSet); |
130 }; | 127 }; |
131 | 128 |
132 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsNotSet, NoQuicRegulations) { | 129 IN_PROC_BROWSER_TEST_F(QuicAllowedPolicyIsNotSet, NoQuicRegulations) { |
133 VerifyQuicEnabledStatusInIOThread(true); | 130 VerifyQuicEnabledStatusInIOThread(true); |
134 } | 131 } |
135 | 132 |
136 } // namespace policy | 133 } // namespace policy |
OLD | NEW |