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

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

Powered by Google App Engine
This is Rietveld 408576698