| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 #include <string.h> | 6 #include <string.h> |
| 7 | 7 |
| 8 #include <stack> | 8 #include <stack> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 74 } |
| 75 | 75 |
| 76 static void TearDownTestCase() { | 76 static void TearDownTestCase() { |
| 77 io_thread_.reset(NULL); | 77 io_thread_.reset(NULL); |
| 78 } | 78 } |
| 79 | 79 |
| 80 AppCacheResponseTest() {} | 80 AppCacheResponseTest() {} |
| 81 | 81 |
| 82 template <class Method> | 82 template <class Method> |
| 83 void RunTestOnIOThread(Method method) { | 83 void RunTestOnIOThread(Method method) { |
| 84 test_finished_event_ .reset(new base::WaitableEvent(false, false)); | 84 test_finished_event_.reset(new base::WaitableEvent( |
| 85 base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 86 base::WaitableEvent::InitialState::NOT_SIGNALED)); |
| 85 io_thread_->task_runner()->PostTask( | 87 io_thread_->task_runner()->PostTask( |
| 86 FROM_HERE, base::Bind(&AppCacheResponseTest::MethodWrapper<Method>, | 88 FROM_HERE, base::Bind(&AppCacheResponseTest::MethodWrapper<Method>, |
| 87 base::Unretained(this), method)); | 89 base::Unretained(this), method)); |
| 88 test_finished_event_->Wait(); | 90 test_finished_event_->Wait(); |
| 89 } | 91 } |
| 90 | 92 |
| 91 void SetUpTest() { | 93 void SetUpTest() { |
| 92 DCHECK(base::MessageLoop::current() == io_thread_->message_loop()); | 94 DCHECK(base::MessageLoop::current() == io_thread_->message_loop()); |
| 93 DCHECK(task_stack_.empty()); | 95 DCHECK(task_stack_.empty()); |
| 94 storage_delegate_.reset(new MockStorageDelegate(this)); | 96 storage_delegate_.reset(new MockStorageDelegate(this)); |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 | 818 |
| 817 TEST_F(AppCacheResponseTest, DeleteWithinCallbacks) { | 819 TEST_F(AppCacheResponseTest, DeleteWithinCallbacks) { |
| 818 RunTestOnIOThread(&AppCacheResponseTest::DeleteWithinCallbacks); | 820 RunTestOnIOThread(&AppCacheResponseTest::DeleteWithinCallbacks); |
| 819 } | 821 } |
| 820 | 822 |
| 821 TEST_F(AppCacheResponseTest, DeleteWithIOPending) { | 823 TEST_F(AppCacheResponseTest, DeleteWithIOPending) { |
| 822 RunTestOnIOThread(&AppCacheResponseTest::DeleteWithIOPending); | 824 RunTestOnIOThread(&AppCacheResponseTest::DeleteWithIOPending); |
| 823 } | 825 } |
| 824 | 826 |
| 825 } // namespace content | 827 } // namespace content |
| OLD | NEW |