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 "content/browser/appcache/appcache_url_request_job.h" | 5 #include "content/browser/appcache/appcache_url_request_job.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 } | 231 } |
232 | 232 |
233 static void TearDownTestCase() { | 233 static void TearDownTestCase() { |
234 io_thread_.reset(NULL); | 234 io_thread_.reset(NULL); |
235 } | 235 } |
236 | 236 |
237 AppCacheURLRequestJobTest() {} | 237 AppCacheURLRequestJobTest() {} |
238 | 238 |
239 template <class Method> | 239 template <class Method> |
240 void RunTestOnIOThread(Method method) { | 240 void RunTestOnIOThread(Method method) { |
241 test_finished_event_ .reset(new base::WaitableEvent(false, false)); | 241 test_finished_event_.reset(new base::WaitableEvent( |
| 242 base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 243 base::WaitableEvent::InitialState::NOT_SIGNALED)); |
242 io_thread_->task_runner()->PostTask( | 244 io_thread_->task_runner()->PostTask( |
243 FROM_HERE, base::Bind(&AppCacheURLRequestJobTest::MethodWrapper<Method>, | 245 FROM_HERE, base::Bind(&AppCacheURLRequestJobTest::MethodWrapper<Method>, |
244 base::Unretained(this), method)); | 246 base::Unretained(this), method)); |
245 test_finished_event_->Wait(); | 247 test_finished_event_->Wait(); |
246 } | 248 } |
247 | 249 |
248 void SetUpTest() { | 250 void SetUpTest() { |
249 DCHECK(base::MessageLoop::current() == io_thread_->message_loop()); | 251 DCHECK(base::MessageLoop::current() == io_thread_->message_loop()); |
250 DCHECK(task_stack_.empty()); | 252 DCHECK(task_stack_.empty()); |
251 | 253 |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 | 893 |
892 TEST_F(AppCacheURLRequestJobTest, CancelRequest) { | 894 TEST_F(AppCacheURLRequestJobTest, CancelRequest) { |
893 RunTestOnIOThread(&AppCacheURLRequestJobTest::CancelRequest); | 895 RunTestOnIOThread(&AppCacheURLRequestJobTest::CancelRequest); |
894 } | 896 } |
895 | 897 |
896 TEST_F(AppCacheURLRequestJobTest, CancelRequestWithIOPending) { | 898 TEST_F(AppCacheURLRequestJobTest, CancelRequestWithIOPending) { |
897 RunTestOnIOThread(&AppCacheURLRequestJobTest::CancelRequestWithIOPending); | 899 RunTestOnIOThread(&AppCacheURLRequestJobTest::CancelRequestWithIOPending); |
898 } | 900 } |
899 | 901 |
900 } // namespace content | 902 } // namespace content |
OLD | NEW |