OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/data_reduction_proxy/content/browser/content_lofi_ui_servic
e.h" | 5 #include "components/data_reduction_proxy/content/browser/content_lofi_ui_servic
e.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 EXPECT_TRUE( | 37 EXPECT_TRUE( |
38 content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 38 content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
39 | 39 |
40 net::TestURLRequestContext context(true); | 40 net::TestURLRequestContext context(true); |
41 net::MockClientSocketFactory mock_socket_factory; | 41 net::MockClientSocketFactory mock_socket_factory; |
42 net::TestDelegate delegate; | 42 net::TestDelegate delegate; |
43 context.set_client_socket_factory(&mock_socket_factory); | 43 context.set_client_socket_factory(&mock_socket_factory); |
44 context.Init(); | 44 context.Init(); |
45 | 45 |
46 content_lofi_ui_service_.reset(new ContentLoFiUIService( | 46 content_lofi_ui_service_.reset(new ContentLoFiUIService( |
47 content::BrowserThread::GetMessageLoopProxyForThread( | 47 content::BrowserThread::GetTaskRunnerForThread( |
48 content::BrowserThread::UI), | 48 content::BrowserThread::UI), |
49 base::Bind(&ContentLoFiUIServiceTest::OnLoFiResponseReceivedCallback, | 49 base::Bind(&ContentLoFiUIServiceTest::OnLoFiResponseReceivedCallback, |
50 base::Unretained(this)))); | 50 base::Unretained(this)))); |
51 | 51 |
52 std::unique_ptr<net::URLRequest> request = | 52 std::unique_ptr<net::URLRequest> request = |
53 CreateRequest(context, &delegate); | 53 CreateRequest(context, &delegate); |
54 | 54 |
55 content_lofi_ui_service_->OnLoFiReponseReceived(*request, is_preview); | 55 content_lofi_ui_service_->OnLoFiReponseReceived(*request, is_preview); |
56 | 56 |
57 content::BrowserThread::PostTask( | 57 content::BrowserThread::PostTask( |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 content::BrowserThread::PostTask( | 118 content::BrowserThread::PostTask( |
119 content::BrowserThread::IO, FROM_HERE, | 119 content::BrowserThread::IO, FROM_HERE, |
120 base::Bind(&ContentLoFiUIServiceTest::RunTestOnIOThread, | 120 base::Bind(&ContentLoFiUIServiceTest::RunTestOnIOThread, |
121 base::Unretained(this), &ui_run_loop, true)); | 121 base::Unretained(this), &ui_run_loop, true)); |
122 ui_run_loop.Run(); | 122 ui_run_loop.Run(); |
123 base::RunLoop().RunUntilIdle(); | 123 base::RunLoop().RunUntilIdle(); |
124 VerifyOnLoFiResponseReceivedCallback(true); | 124 VerifyOnLoFiResponseReceivedCallback(true); |
125 } | 125 } |
126 | 126 |
127 } // namespace data_reduction_proxy | 127 } // namespace data_reduction_proxy |
OLD | NEW |