OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/extensions/api/image_writer_private/write_from_url_oper
ation.h" | 5 #include "chrome/browser/extensions/api/image_writer_private/write_from_url_oper
ation.h" |
6 | 6 |
7 #include "base/threading/sequenced_worker_pool.h" | 7 #include "base/threading/sequenced_worker_pool.h" |
8 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" | 8 #include "chrome/browser/extensions/api/image_writer_private/error_messages.h" |
9 #include "chrome/browser/extensions/api/image_writer_private/test_utils.h" | 9 #include "chrome/browser/extensions/api/image_writer_private/test_utils.h" |
10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 EXPECT_CALL( | 155 EXPECT_CALL( |
156 manager_, | 156 manager_, |
157 OnProgress(kDummyExtensionId, image_writer_api::STAGE_DOWNLOAD, 0)) | 157 OnProgress(kDummyExtensionId, image_writer_api::STAGE_DOWNLOAD, 0)) |
158 .Times(AnyNumber()); | 158 .Times(AnyNumber()); |
159 EXPECT_CALL( | 159 EXPECT_CALL( |
160 manager_, | 160 manager_, |
161 OnProgress(kDummyExtensionId, image_writer_api::STAGE_DOWNLOAD, 100)) | 161 OnProgress(kDummyExtensionId, image_writer_api::STAGE_DOWNLOAD, 100)) |
162 .Times(AnyNumber()); | 162 .Times(AnyNumber()); |
163 | 163 |
164 content::BrowserThread::PostTask( | 164 content::BrowserThread::PostTask( |
165 content::BrowserThread::FILE, | 165 content::BrowserThread::FILE, FROM_HERE, |
166 FROM_HERE, | 166 base::BindOnce(&OperationForTest::Download, operation, quit_closure)); |
167 base::Bind(&OperationForTest::Download, operation, quit_closure)); | |
168 | 167 |
169 runloop.Run(); | 168 runloop.Run(); |
170 | 169 |
171 EXPECT_TRUE(base::ContentsEqual(test_utils_.GetImagePath(), | 170 EXPECT_TRUE(base::ContentsEqual(test_utils_.GetImagePath(), |
172 operation->GetImagePath())); | 171 operation->GetImagePath())); |
173 | 172 |
174 EXPECT_EQ(1, get_interceptor_->GetHitCount()); | 173 EXPECT_EQ(1, get_interceptor_->GetHitCount()); |
175 | 174 |
176 operation->Cancel(); | 175 operation->Cancel(); |
177 } | 176 } |
(...skipping 15 matching lines...) Expand all Loading... |
193 EXPECT_CALL( | 192 EXPECT_CALL( |
194 manager_, | 193 manager_, |
195 OnProgress(kDummyExtensionId, image_writer_api::STAGE_VERIFYDOWNLOAD, 0)) | 194 OnProgress(kDummyExtensionId, image_writer_api::STAGE_VERIFYDOWNLOAD, 0)) |
196 .Times(AtLeast(1)); | 195 .Times(AtLeast(1)); |
197 EXPECT_CALL(manager_, | 196 EXPECT_CALL(manager_, |
198 OnProgress(kDummyExtensionId, | 197 OnProgress(kDummyExtensionId, |
199 image_writer_api::STAGE_VERIFYDOWNLOAD, | 198 image_writer_api::STAGE_VERIFYDOWNLOAD, |
200 100)).Times(AtLeast(1)); | 199 100)).Times(AtLeast(1)); |
201 | 200 |
202 operation->SetImagePath(test_utils_.GetImagePath()); | 201 operation->SetImagePath(test_utils_.GetImagePath()); |
203 content::BrowserThread::PostTask(content::BrowserThread::FILE, | 202 content::BrowserThread::PostTask( |
204 FROM_HERE, | 203 content::BrowserThread::FILE, FROM_HERE, |
205 base::Bind(&OperationForTest::VerifyDownload, | 204 base::BindOnce(&OperationForTest::VerifyDownload, operation, |
206 operation, | 205 base::Bind(&base::DoNothing))); |
207 base::Bind(&base::DoNothing))); | |
208 | 206 |
209 base::RunLoop().RunUntilIdle(); | 207 base::RunLoop().RunUntilIdle(); |
210 | 208 |
211 operation->Cancel(); | 209 operation->Cancel(); |
212 } | 210 } |
213 | 211 |
214 } // namespace | 212 } // namespace |
215 | 213 |
216 } // namespace image_writer | 214 } // namespace image_writer |
217 } // namespace extensions | 215 } // namespace extensions |
OLD | NEW |