Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Side by Side Diff: content/browser/fileapi/file_system_dir_url_request_job_unittest.cc

Issue 1159623009: content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test build fix. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "storage/browser/fileapi/file_system_dir_url_request_job.h" 5 #include "storage/browser/fileapi/file_system_dir_url_request_job.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/files/scoped_temp_dir.h" 11 #include "base/files/scoped_temp_dir.h"
12 #include "base/format_macros.h" 12 #include "base/format_macros.h"
13 #include "base/location.h"
13 #include "base/memory/scoped_vector.h" 14 #include "base/memory/scoped_vector.h"
14 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
15 #include "base/message_loop/message_loop.h"
16 #include "base/run_loop.h" 16 #include "base/run_loop.h"
17 #include "base/strings/string_piece.h" 17 #include "base/strings/string_piece.h"
18 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
19 #include "base/thread_task_runner_handle.h"
19 #include "content/public/test/mock_special_storage_policy.h" 20 #include "content/public/test/mock_special_storage_policy.h"
20 #include "content/public/test/test_file_system_backend.h" 21 #include "content/public/test/test_file_system_backend.h"
21 #include "content/public/test/test_file_system_context.h" 22 #include "content/public/test/test_file_system_context.h"
22 #include "net/base/net_errors.h" 23 #include "net/base/net_errors.h"
23 #include "net/base/net_util.h" 24 #include "net/base/net_util.h"
24 #include "net/base/request_priority.h" 25 #include "net/base/request_priority.h"
25 #include "net/http/http_request_headers.h" 26 #include "net/http/http_request_headers.h"
26 #include "net/url_request/url_request.h" 27 #include "net/url_request/url_request.h"
27 #include "net/url_request/url_request_context.h" 28 #include "net/url_request/url_request_context.h"
28 #include "net/url_request/url_request_test_util.h" 29 #include "net/url_request/url_request_test_util.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 request_.reset(NULL); 147 request_.reset(NULL);
147 delegate_.reset(NULL); 148 delegate_.reset(NULL);
148 } 149 }
149 150
150 void SetUpAutoMountContext(base::FilePath* mnt_point) { 151 void SetUpAutoMountContext(base::FilePath* mnt_point) {
151 *mnt_point = temp_dir_.path().AppendASCII("auto_mount_dir"); 152 *mnt_point = temp_dir_.path().AppendASCII("auto_mount_dir");
152 ASSERT_TRUE(base::CreateDirectory(*mnt_point)); 153 ASSERT_TRUE(base::CreateDirectory(*mnt_point));
153 154
154 ScopedVector<storage::FileSystemBackend> additional_providers; 155 ScopedVector<storage::FileSystemBackend> additional_providers;
155 additional_providers.push_back(new TestFileSystemBackend( 156 additional_providers.push_back(new TestFileSystemBackend(
156 base::MessageLoopProxy::current().get(), *mnt_point)); 157 base::ThreadTaskRunnerHandle::Get().get(), *mnt_point));
157 158
158 std::vector<storage::URLRequestAutoMountHandler> handlers; 159 std::vector<storage::URLRequestAutoMountHandler> handlers;
159 handlers.push_back(base::Bind(&TestAutoMountForURLRequest)); 160 handlers.push_back(base::Bind(&TestAutoMountForURLRequest));
160 161
161 file_system_context_ = CreateFileSystemContextWithAutoMountersForTesting( 162 file_system_context_ = CreateFileSystemContextWithAutoMountersForTesting(
162 NULL, additional_providers.Pass(), handlers, temp_dir_.path()); 163 NULL, additional_providers.Pass(), handlers, temp_dir_.path());
163 } 164 }
164 165
165 void OnOpenFileSystem(const GURL& root_url, 166 void OnOpenFileSystem(const GURL& root_url,
166 const std::string& name, 167 const std::string& name,
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 279
279 GURL CreateFileSystemURL(const std::string path) { 280 GURL CreateFileSystemURL(const std::string path) {
280 return GURL(kFileSystemURLPrefix + path); 281 return GURL(kFileSystemURLPrefix + path);
281 } 282 }
282 283
283 storage::FileSystemFileUtil* file_util() { 284 storage::FileSystemFileUtil* file_util() {
284 return file_system_context_->sandbox_delegate()->sync_file_util(); 285 return file_system_context_->sandbox_delegate()->sync_file_util();
285 } 286 }
286 287
287 // Put the message loop at the top, so that it's the last thing deleted. 288 // Put the message loop at the top, so that it's the last thing deleted.
288 // Delete all MessageLoopProxy objects before the MessageLoop, to help prevent 289 // Delete all task runner objects before the MessageLoop, to help prevent
289 // leaks caused by tasks posted during shutdown. 290 // leaks caused by tasks posted during shutdown.
290 base::MessageLoopForIO message_loop_; 291 base::MessageLoopForIO message_loop_;
291 292
292 base::ScopedTempDir temp_dir_; 293 base::ScopedTempDir temp_dir_;
293 net::URLRequestContext empty_context_; 294 net::URLRequestContext empty_context_;
294 scoped_ptr<net::TestDelegate> delegate_; 295 scoped_ptr<net::TestDelegate> delegate_;
295 scoped_ptr<net::URLRequest> request_; 296 scoped_ptr<net::URLRequest> request_;
296 scoped_ptr<FileSystemDirURLRequestJobFactory> job_factory_; 297 scoped_ptr<FileSystemDirURLRequestJobFactory> job_factory_;
297 scoped_refptr<MockSpecialStoragePolicy> special_storage_policy_; 298 scoped_refptr<MockSpecialStoragePolicy> special_storage_policy_;
298 scoped_refptr<FileSystemContext> file_system_context_; 299 scoped_refptr<FileSystemContext> file_system_context_;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 ASSERT_FALSE(request_->status().is_success()); 446 ASSERT_FALSE(request_->status().is_success());
446 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error()); 447 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error());
447 448
448 ASSERT_FALSE( 449 ASSERT_FALSE(
449 storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( 450 storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem(
450 kValidExternalMountPoint)); 451 kValidExternalMountPoint));
451 } 452 }
452 453
453 } // namespace 454 } // namespace
454 } // namespace content 455 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698