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

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/callback_helper_unittest.cc

Issue 1815363002: Add RetainedRef uses where needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/sync_file_system/drive_backend/callback_helper.h" 5 #include "chrome/browser/sync_file_system/drive_backend/callback_helper.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 thread.Start(); 67 thread.Start();
68 68
69 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner = 69 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner =
70 base::ThreadTaskRunnerHandle::Get(); 70 base::ThreadTaskRunnerHandle::Get();
71 scoped_refptr<base::SequencedTaskRunner> worker_task_runner = 71 scoped_refptr<base::SequencedTaskRunner> worker_task_runner =
72 thread.task_runner(); 72 thread.task_runner();
73 73
74 bool called = false; 74 bool called = false;
75 base::RunLoop run_loop; 75 base::RunLoop run_loop;
76 worker_task_runner->PostTask( 76 worker_task_runner->PostTask(
77 FROM_HERE, 77 FROM_HERE, RelayCallbackToTaskRunner(
78 RelayCallbackToTaskRunner( 78 ui_task_runner.get(), FROM_HERE,
79 ui_task_runner.get(), 79 base::Bind(&VerifyCalledOnTaskRunner,
80 FROM_HERE, 80 base::RetainedRef(ui_task_runner), &called)));
81 base::Bind(&VerifyCalledOnTaskRunner, ui_task_runner, &called)));
82 worker_task_runner->PostTask( 81 worker_task_runner->PostTask(
83 FROM_HERE, 82 FROM_HERE,
84 RelayCallbackToTaskRunner( 83 RelayCallbackToTaskRunner(
85 ui_task_runner.get(), FROM_HERE, run_loop.QuitClosure())); 84 ui_task_runner.get(), FROM_HERE, run_loop.QuitClosure()));
86 run_loop.Run(); 85 run_loop.Run();
87 EXPECT_TRUE(called); 86 EXPECT_TRUE(called);
88 87
89 thread.Stop(); 88 thread.Stop();
90 base::RunLoop().RunUntilIdle(); 89 base::RunLoop().RunUntilIdle();
91 } 90 }
92 91
93 TEST(DriveBackendCallbackHelperTest, PassNullFunctionTest) { 92 TEST(DriveBackendCallbackHelperTest, PassNullFunctionTest) {
94 base::MessageLoop message_loop; 93 base::MessageLoop message_loop;
95 base::Closure closure = RelayCallbackToCurrentThread( 94 base::Closure closure = RelayCallbackToCurrentThread(
96 FROM_HERE, 95 FROM_HERE,
97 base::Closure()); 96 base::Closure());
98 EXPECT_TRUE(closure.is_null()); 97 EXPECT_TRUE(closure.is_null());
99 } 98 }
100 99
101 } // namespace drive_backend 100 } // namespace drive_backend
102 } // namespace sync_file_system 101 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698