| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <stack> | 5 #include <stack> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 void RunTestOnIOThread(Method method) { | 167 void RunTestOnIOThread(Method method) { |
| 168 test_finished_event_ .reset(new base::WaitableEvent(false, false)); | 168 test_finished_event_ .reset(new base::WaitableEvent(false, false)); |
| 169 io_thread_->message_loop()->PostTask( | 169 io_thread_->message_loop()->PostTask( |
| 170 FROM_HERE, new WrapperTask<Method>(this, method)); | 170 FROM_HERE, new WrapperTask<Method>(this, method)); |
| 171 test_finished_event_->Wait(); | 171 test_finished_event_->Wait(); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void SetUpTest() { | 174 void SetUpTest() { |
| 175 DCHECK(MessageLoop::current() == io_thread_->message_loop()); | 175 DCHECK(MessageLoop::current() == io_thread_->message_loop()); |
| 176 | 176 |
| 177 net::URLRequest::RegisterProtocolFactory("blob", &BlobURLRequestJobFactory); | 177 net::URLRequest::Deprecated::RegisterProtocolFactory( |
| 178 "blob", &BlobURLRequestJobFactory); |
| 178 url_request_delegate_.reset(new MockURLRequestDelegate(this)); | 179 url_request_delegate_.reset(new MockURLRequestDelegate(this)); |
| 179 } | 180 } |
| 180 | 181 |
| 181 void TearDownTest() { | 182 void TearDownTest() { |
| 182 DCHECK(MessageLoop::current() == io_thread_->message_loop()); | 183 DCHECK(MessageLoop::current() == io_thread_->message_loop()); |
| 183 | 184 |
| 184 request_.reset(); | 185 request_.reset(); |
| 185 url_request_delegate_.reset(); | 186 url_request_delegate_.reset(); |
| 186 | 187 |
| 187 DCHECK(!blob_url_request_job_); | 188 DCHECK(!blob_url_request_job_); |
| 188 net::URLRequest::RegisterProtocolFactory("blob", NULL); | 189 net::URLRequest::Deprecated::RegisterProtocolFactory("blob", NULL); |
| 189 } | 190 } |
| 190 | 191 |
| 191 void TestFinished() { | 192 void TestFinished() { |
| 192 // We unwind the stack prior to finishing up to let stack | 193 // We unwind the stack prior to finishing up to let stack |
| 193 // based objects get deleted. | 194 // based objects get deleted. |
| 194 DCHECK(MessageLoop::current() == io_thread_->message_loop()); | 195 DCHECK(MessageLoop::current() == io_thread_->message_loop()); |
| 195 MessageLoop::current()->PostTask(FROM_HERE, | 196 MessageLoop::current()->PostTask(FROM_HERE, |
| 196 NewRunnableMethod( | 197 NewRunnableMethod( |
| 197 this, &BlobURLRequestJobTest::TestFinishedUnwound)); | 198 this, &BlobURLRequestJobTest::TestFinishedUnwound)); |
| 198 } | 199 } |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 | 462 |
| 462 TEST_F(BlobURLRequestJobTest, TestExtraHeaders) { | 463 TEST_F(BlobURLRequestJobTest, TestExtraHeaders) { |
| 463 RunTestOnIOThread(&BlobURLRequestJobTest::TestExtraHeaders); | 464 RunTestOnIOThread(&BlobURLRequestJobTest::TestExtraHeaders); |
| 464 } | 465 } |
| 465 | 466 |
| 466 } // namespace webkit_blob | 467 } // namespace webkit_blob |
| 467 | 468 |
| 468 // BlobURLRequestJobTest is expected to always live longer than the | 469 // BlobURLRequestJobTest is expected to always live longer than the |
| 469 // runnable methods. This lets us call NewRunnableMethod on its instances. | 470 // runnable methods. This lets us call NewRunnableMethod on its instances. |
| 470 DISABLE_RUNNABLE_METHOD_REFCOUNT(webkit_blob::BlobURLRequestJobTest); | 471 DISABLE_RUNNABLE_METHOD_REFCOUNT(webkit_blob::BlobURLRequestJobTest); |
| OLD | NEW |