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 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/message_loop/message_loop.h" | |
15 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
16 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
17 #include "content/public/browser/render_frame_host.h" | 16 #include "content/public/browser/render_frame_host.h" |
18 #include "content/public/browser/render_process_host.h" | 17 #include "content/public/browser/render_process_host.h" |
19 #include "content/public/browser/resource_request_info.h" | 18 #include "content/public/browser/resource_request_info.h" |
20 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
21 #include "content/public/test/test_renderer_host.h" | 20 #include "content/public/test/test_renderer_host.h" |
22 #include "net/socket/socket_test_util.h" | 21 #include "net/socket/socket_test_util.h" |
23 #include "net/url_request/url_request.h" | 22 #include "net/url_request/url_request.h" |
24 #include "net/url_request/url_request_test_util.h" | 23 #include "net/url_request/url_request_test_util.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 bool is_preview_; | 102 bool is_preview_; |
104 }; | 103 }; |
105 | 104 |
106 TEST_F(ContentLoFiUIServiceTest, OnLoFiResponseReceived) { | 105 TEST_F(ContentLoFiUIServiceTest, OnLoFiResponseReceived) { |
107 base::RunLoop ui_run_loop; | 106 base::RunLoop ui_run_loop; |
108 content::BrowserThread::PostTask( | 107 content::BrowserThread::PostTask( |
109 content::BrowserThread::IO, FROM_HERE, | 108 content::BrowserThread::IO, FROM_HERE, |
110 base::Bind(&ContentLoFiUIServiceTest::RunTestOnIOThread, | 109 base::Bind(&ContentLoFiUIServiceTest::RunTestOnIOThread, |
111 base::Unretained(this), &ui_run_loop, false)); | 110 base::Unretained(this), &ui_run_loop, false)); |
112 ui_run_loop.Run(); | 111 ui_run_loop.Run(); |
113 base::MessageLoop::current()->RunUntilIdle(); | 112 base::RunLoop().RunUntilIdle(); |
114 VerifyOnLoFiResponseReceivedCallback(false); | 113 VerifyOnLoFiResponseReceivedCallback(false); |
115 } | 114 } |
116 | 115 |
117 TEST_F(ContentLoFiUIServiceTest, OnLoFiPreviewResponseReceived) { | 116 TEST_F(ContentLoFiUIServiceTest, OnLoFiPreviewResponseReceived) { |
118 base::RunLoop ui_run_loop; | 117 base::RunLoop ui_run_loop; |
119 content::BrowserThread::PostTask( | 118 content::BrowserThread::PostTask( |
120 content::BrowserThread::IO, FROM_HERE, | 119 content::BrowserThread::IO, FROM_HERE, |
121 base::Bind(&ContentLoFiUIServiceTest::RunTestOnIOThread, | 120 base::Bind(&ContentLoFiUIServiceTest::RunTestOnIOThread, |
122 base::Unretained(this), &ui_run_loop, true)); | 121 base::Unretained(this), &ui_run_loop, true)); |
123 ui_run_loop.Run(); | 122 ui_run_loop.Run(); |
124 base::MessageLoop::current()->RunUntilIdle(); | 123 base::RunLoop().RunUntilIdle(); |
125 VerifyOnLoFiResponseReceivedCallback(true); | 124 VerifyOnLoFiResponseReceivedCallback(true); |
126 } | 125 } |
127 | 126 |
128 } // namespace data_reduction_proxy | 127 } // namespace data_reduction_proxy |
OLD | NEW |