OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chromeos/drive/drive_url_request_job.h" | 5 #include "chrome/browser/chromeos/drive/drive_url_request_job.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 base::Bind(&DriveURLRequestJobTest::GetFileSystem, | 122 base::Bind(&DriveURLRequestJobTest::GetFileSystem, |
123 base::Unretained(this)), | 123 base::Unretained(this)), |
124 blocking_pool->GetSequencedTaskRunner( | 124 blocking_pool->GetSequencedTaskRunner( |
125 blocking_pool->GetSequenceToken()))); | 125 blocking_pool->GetSequenceToken()))); |
126 url_request_context_.reset(new net::URLRequestContext()); | 126 url_request_context_.reset(new net::URLRequestContext()); |
127 url_request_context_->set_job_factory(test_url_request_job_factory_.get()); | 127 url_request_context_->set_job_factory(test_url_request_job_factory_.get()); |
128 url_request_context_->set_network_delegate(test_network_delegate_.get()); | 128 url_request_context_->set_network_delegate(test_network_delegate_.get()); |
129 test_delegate_.reset(new TestDelegate); | 129 test_delegate_.reset(new TestDelegate); |
130 } | 130 } |
131 | 131 |
132 virtual void TearDown() OVERRIDE { | |
133 test_delegate_.reset(); | |
134 url_request_context_.reset(); | |
135 test_url_request_job_factory_.reset(); | |
136 test_network_delegate_.reset(); | |
137 | |
138 fake_file_system_.reset(); | |
139 fake_drive_service_.reset(); | |
140 } | |
141 | |
142 FileSystemInterface* GetFileSystem() { | 132 FileSystemInterface* GetFileSystem() { |
143 return fake_file_system_.get(); | 133 return fake_file_system_.get(); |
144 } | 134 } |
145 | 135 |
146 bool ReadDriveFileSync( | 136 bool ReadDriveFileSync( |
147 const base::FilePath& file_path, std::string* out_content) { | 137 const base::FilePath& file_path, std::string* out_content) { |
148 scoped_ptr<base::Thread> worker_thread( | 138 scoped_ptr<base::Thread> worker_thread( |
149 new base::Thread("ReadDriveFileSync")); | 139 new base::Thread("ReadDriveFileSync")); |
150 if (!worker_thread->Start()) | 140 if (!worker_thread->Start()) |
151 return false; | 141 return false; |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 "Range", "Wrong Range Header Value", false /* overwrite */); | 361 "Range", "Wrong Range Header Value", false /* overwrite */); |
372 request.Start(); | 362 request.Start(); |
373 | 363 |
374 base::RunLoop().Run(); | 364 base::RunLoop().Run(); |
375 | 365 |
376 EXPECT_EQ(net::URLRequestStatus::FAILED, request.status().status()); | 366 EXPECT_EQ(net::URLRequestStatus::FAILED, request.status().status()); |
377 EXPECT_EQ(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE, request.status().error()); | 367 EXPECT_EQ(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE, request.status().error()); |
378 } | 368 } |
379 | 369 |
380 } // namespace drive | 370 } // namespace drive |
OLD | NEW |