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

Side by Side Diff: content/browser/fileapi/recursive_operation_delegate_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/recursive_operation_delegate.h" 5 #include "storage/browser/fileapi/recursive_operation_delegate.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/files/scoped_temp_dir.h" 12 #include "base/files/scoped_temp_dir.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/location.h"
14 #include "base/message_loop/message_loop_proxy.h"
15 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/single_thread_task_runner.h"
16 #include "base/thread_task_runner_handle.h"
16 #include "content/public/test/sandbox_file_system_test_helper.h" 17 #include "content/public/test/sandbox_file_system_test_helper.h"
17 #include "storage/browser/fileapi/file_system_file_util.h" 18 #include "storage/browser/fileapi/file_system_file_util.h"
18 #include "storage/browser/fileapi/file_system_operation.h" 19 #include "storage/browser/fileapi/file_system_operation.h"
19 #include "storage/browser/fileapi/file_system_operation_runner.h" 20 #include "storage/browser/fileapi/file_system_operation_runner.h"
20 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
21 22
22 using storage::FileSystemContext; 23 using storage::FileSystemContext;
23 using storage::FileSystemOperationContext; 24 using storage::FileSystemOperationContext;
24 using storage::FileSystemURL; 25 using storage::FileSystemURL;
25 26
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 base::File::Error error) { 109 base::File::Error error) {
109 DCHECK(out_error); 110 DCHECK(out_error);
110 *out_error = error; 111 *out_error = error;
111 } 112 }
112 113
113 // To test the Cancel() during operation, calls Cancel() of |operation| 114 // To test the Cancel() during operation, calls Cancel() of |operation|
114 // after |counter| times message posting. 115 // after |counter| times message posting.
115 void CallCancelLater(storage::RecursiveOperationDelegate* operation, 116 void CallCancelLater(storage::RecursiveOperationDelegate* operation,
116 int counter) { 117 int counter) {
117 if (counter > 0) { 118 if (counter > 0) {
118 base::MessageLoopProxy::current()->PostTask( 119 base::ThreadTaskRunnerHandle::Get()->PostTask(
119 FROM_HERE, 120 FROM_HERE,
120 base::Bind(&CallCancelLater, base::Unretained(operation), counter - 1)); 121 base::Bind(&CallCancelLater, base::Unretained(operation), counter - 1));
121 return; 122 return;
122 } 123 }
123 124
124 operation->Cancel(); 125 operation->Cancel();
125 } 126 }
126 127
127 } // namespace 128 } // namespace
128 129
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 base::Bind(&ReportStatus, &error))); 270 base::Bind(&ReportStatus, &error)));
270 operation->RunRecursively(); 271 operation->RunRecursively();
271 272
272 // Invoke Cancel(), after 5 times message posting. 273 // Invoke Cancel(), after 5 times message posting.
273 CallCancelLater(operation.get(), 5); 274 CallCancelLater(operation.get(), 5);
274 base::RunLoop().RunUntilIdle(); 275 base::RunLoop().RunUntilIdle();
275 ASSERT_EQ(base::File::FILE_ERROR_ABORT, error); 276 ASSERT_EQ(base::File::FILE_ERROR_ABORT, error);
276 } 277 }
277 278
278 } // namespace content 279 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698