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

Side by Side Diff: mojo/public/cpp/bindings/tests/sync_method_unittest.cc

Issue 2958703002: Rename TaskRunner::RunsTasksOnCurrentThread() in //ipc, //mojo (Closed)
Patch Set: Created 3 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <utility> 5 #include <utility>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 }; 259 };
260 260
261 template <typename Interface> 261 template <typename Interface>
262 class TestSyncServiceSequence { 262 class TestSyncServiceSequence {
263 public: 263 public:
264 TestSyncServiceSequence() 264 TestSyncServiceSequence()
265 : task_runner_(base::CreateSequencedTaskRunnerWithTraits({})), 265 : task_runner_(base::CreateSequencedTaskRunnerWithTraits({})),
266 ping_called_(false) {} 266 ping_called_(false) {}
267 267
268 void SetUp(InterfaceRequest<Interface> request) { 268 void SetUp(InterfaceRequest<Interface> request) {
269 CHECK(task_runner()->RunsTasksOnCurrentThread()); 269 CHECK(task_runner()->RunsTasksInCurrentSequence());
270 impl_.reset(new ImplTypeFor<Interface>(std::move(request))); 270 impl_.reset(new ImplTypeFor<Interface>(std::move(request)));
271 impl_->set_ping_handler( 271 impl_->set_ping_handler(
272 [this](const typename Interface::PingCallback& callback) { 272 [this](const typename Interface::PingCallback& callback) {
273 { 273 {
274 base::AutoLock locker(lock_); 274 base::AutoLock locker(lock_);
275 ping_called_ = true; 275 ping_called_ = true;
276 } 276 }
277 callback.Run(); 277 callback.Run();
278 }); 278 });
279 } 279 }
280 280
281 void TearDown() { 281 void TearDown() {
282 CHECK(task_runner()->RunsTasksOnCurrentThread()); 282 CHECK(task_runner()->RunsTasksInCurrentSequence());
283 impl_.reset(); 283 impl_.reset();
284 } 284 }
285 285
286 base::SequencedTaskRunner* task_runner() { return task_runner_.get(); } 286 base::SequencedTaskRunner* task_runner() { return task_runner_.get(); }
287 bool ping_called() const { 287 bool ping_called() const {
288 base::AutoLock locker(lock_); 288 base::AutoLock locker(lock_);
289 return ping_called_; 289 return ping_called_;
290 } 290 }
291 291
292 private: 292 private:
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 int32_t result_value = -1; 1229 int32_t result_value = -1;
1230 ASSERT_TRUE(master_ptr_->Echo(456, &result_value)); 1230 ASSERT_TRUE(master_ptr_->Echo(456, &result_value));
1231 EXPECT_EQ(456, result_value); 1231 EXPECT_EQ(456, result_value);
1232 } 1232 }
1233 1233
1234 // TODO(yzshen): Add more tests related to associated interfaces. 1234 // TODO(yzshen): Add more tests related to associated interfaces.
1235 1235
1236 } // namespace 1236 } // namespace
1237 } // namespace test 1237 } // namespace test
1238 } // namespace mojo 1238 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/tests/associated_interface_unittest.cc ('k') | mojo/public/cpp/system/simple_watcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698