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

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

Issue 1170623003: Revert "content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/location.h"
10 #include "base/run_loop.h" 9 #include "base/run_loop.h"
11 #include "base/single_thread_task_runner.h"
12 #include "base/thread_task_runner_handle.h"
13 #include "content/public/test/async_file_test_helper.h" 10 #include "content/public/test/async_file_test_helper.h"
14 #include "content/public/test/mock_special_storage_policy.h" 11 #include "content/public/test/mock_special_storage_policy.h"
15 #include "content/public/test/test_file_system_backend.h" 12 #include "content/public/test/test_file_system_backend.h"
16 #include "content/public/test/test_file_system_context.h" 13 #include "content/public/test/test_file_system_context.h"
17 #include "storage/browser/blob/shareable_file_reference.h" 14 #include "storage/browser/blob/shareable_file_reference.h"
18 #include "storage/browser/fileapi/copy_or_move_file_validator.h" 15 #include "storage/browser/fileapi/copy_or_move_file_validator.h"
19 #include "storage/browser/fileapi/external_mount_points.h" 16 #include "storage/browser/fileapi/external_mount_points.h"
20 #include "storage/browser/fileapi/file_system_backend.h" 17 #include "storage/browser/fileapi/file_system_backend.h"
21 #include "storage/browser/fileapi/file_system_context.h" 18 #include "storage/browser/fileapi/file_system_context.h"
22 #include "storage/browser/fileapi/file_system_url.h" 19 #include "storage/browser/fileapi/file_system_url.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 base::File::FILE_ERROR_SECURITY), 214 base::File::FILE_ERROR_SECURITY),
218 write_result_(validity == VALID || validity == PRE_WRITE_INVALID ? 215 write_result_(validity == VALID || validity == PRE_WRITE_INVALID ?
219 base::File::FILE_OK : 216 base::File::FILE_OK :
220 base::File::FILE_ERROR_SECURITY) { 217 base::File::FILE_ERROR_SECURITY) {
221 } 218 }
222 ~TestCopyOrMoveFileValidator() override {} 219 ~TestCopyOrMoveFileValidator() override {}
223 220
224 void StartPreWriteValidation( 221 void StartPreWriteValidation(
225 const ResultCallback& result_callback) override { 222 const ResultCallback& result_callback) override {
226 // Post the result since a real validator must do work asynchronously. 223 // Post the result since a real validator must do work asynchronously.
227 base::ThreadTaskRunnerHandle::Get()->PostTask( 224 base::MessageLoop::current()->PostTask(
228 FROM_HERE, base::Bind(result_callback, result_)); 225 FROM_HERE, base::Bind(result_callback, result_));
229 } 226 }
230 227
231 void StartPostWriteValidation( 228 void StartPostWriteValidation(
232 const base::FilePath& dest_platform_path, 229 const base::FilePath& dest_platform_path,
233 const ResultCallback& result_callback) override { 230 const ResultCallback& result_callback) override {
234 // Post the result since a real validator must do work asynchronously. 231 // Post the result since a real validator must do work asynchronously.
235 base::ThreadTaskRunnerHandle::Get()->PostTask( 232 base::MessageLoop::current()->PostTask(
236 FROM_HERE, base::Bind(result_callback, write_result_)); 233 FROM_HERE, base::Bind(result_callback, write_result_));
237 } 234 }
238 235
239 private: 236 private:
240 base::File::Error result_; 237 base::File::Error result_;
241 base::File::Error write_result_; 238 base::File::Error write_result_;
242 239
243 DISALLOW_COPY_AND_ASSIGN(TestCopyOrMoveFileValidator); 240 DISALLOW_COPY_AND_ASSIGN(TestCopyOrMoveFileValidator);
244 }; 241 };
245 242
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 helper.SetUp(); 320 helper.SetUp();
324 scoped_ptr<CopyOrMoveFileValidatorFactory> factory( 321 scoped_ptr<CopyOrMoveFileValidatorFactory> factory(
325 new TestCopyOrMoveFileValidatorFactory(POST_WRITE_INVALID)); 322 new TestCopyOrMoveFileValidatorFactory(POST_WRITE_INVALID));
326 helper.SetMediaCopyOrMoveFileValidatorFactory(factory.Pass()); 323 helper.SetMediaCopyOrMoveFileValidatorFactory(factory.Pass());
327 324
328 helper.CopyTest(base::File::FILE_ERROR_SECURITY); 325 helper.CopyTest(base::File::FILE_ERROR_SECURITY);
329 helper.MoveTest(base::File::FILE_ERROR_SECURITY); 326 helper.MoveTest(base::File::FILE_ERROR_SECURITY);
330 } 327 }
331 328
332 } // namespace content 329 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698