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_request_handler.h" | 5 #include "content/browser/appcache/appcache_request_handler.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <stack> | 9 #include <stack> |
10 #include <string> | 10 #include <string> |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 static void TearDownTestCase() { | 177 static void TearDownTestCase() { |
178 io_thread_.reset(NULL); | 178 io_thread_.reset(NULL); |
179 } | 179 } |
180 | 180 |
181 // Test harness -------------------------------------------------- | 181 // Test harness -------------------------------------------------- |
182 | 182 |
183 AppCacheRequestHandlerTest() : host_(NULL) {} | 183 AppCacheRequestHandlerTest() : host_(NULL) {} |
184 | 184 |
185 template <class Method> | 185 template <class Method> |
186 void RunTestOnIOThread(Method method) { | 186 void RunTestOnIOThread(Method method) { |
187 test_finished_event_ .reset(new base::WaitableEvent(false, false)); | 187 test_finished_event_.reset(new base::WaitableEvent( |
| 188 base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 189 base::WaitableEvent::InitialState::NOT_SIGNALED)); |
188 io_thread_->task_runner()->PostTask( | 190 io_thread_->task_runner()->PostTask( |
189 FROM_HERE, | 191 FROM_HERE, |
190 base::Bind(&AppCacheRequestHandlerTest::MethodWrapper<Method>, | 192 base::Bind(&AppCacheRequestHandlerTest::MethodWrapper<Method>, |
191 base::Unretained(this), method)); | 193 base::Unretained(this), method)); |
192 test_finished_event_->Wait(); | 194 test_finished_event_->Wait(); |
193 } | 195 } |
194 | 196 |
195 void SetUpTest() { | 197 void SetUpTest() { |
196 DCHECK(base::MessageLoop::current() == io_thread_->message_loop()); | 198 DCHECK(base::MessageLoop::current() == io_thread_->message_loop()); |
197 mock_service_.reset(new MockAppCacheService); | 199 mock_service_.reset(new MockAppCacheService); |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 | 1030 |
1029 TEST_F(AppCacheRequestHandlerTest, WorkerRequest) { | 1031 TEST_F(AppCacheRequestHandlerTest, WorkerRequest) { |
1030 RunTestOnIOThread(&AppCacheRequestHandlerTest::WorkerRequest); | 1032 RunTestOnIOThread(&AppCacheRequestHandlerTest::WorkerRequest); |
1031 } | 1033 } |
1032 | 1034 |
1033 TEST_F(AppCacheRequestHandlerTest, MainResource_Blocked) { | 1035 TEST_F(AppCacheRequestHandlerTest, MainResource_Blocked) { |
1034 RunTestOnIOThread(&AppCacheRequestHandlerTest::MainResource_Blocked); | 1036 RunTestOnIOThread(&AppCacheRequestHandlerTest::MainResource_Blocked); |
1035 } | 1037 } |
1036 | 1038 |
1037 } // namespace content | 1039 } // namespace content |
OLD | NEW |