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

Side by Side Diff: chromeos/dbus/blocking_method_caller_unittest.cc

Issue 2122543002: Replace Closure in TaskRunner::PostTask with OneShotCallback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@07_oneshot
Patch Set: fix Created 4 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chromeos/dbus/blocking_method_caller.h" 5 #include "chromeos/dbus/blocking_method_caller.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/task_runner.h" 11 #include "base/task_runner.h"
12 #include "dbus/message.h" 12 #include "dbus/message.h"
13 #include "dbus/mock_bus.h" 13 #include "dbus/mock_bus.h"
14 #include "dbus/mock_object_proxy.h" 14 #include "dbus/mock_object_proxy.h"
15 #include "dbus/object_path.h" 15 #include "dbus/object_path.h"
16 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 using ::testing::_; 19 using ::testing::_;
20 using ::testing::Invoke; 20 using ::testing::Invoke;
21 using ::testing::Return; 21 using ::testing::Return;
22 22
23 namespace chromeos { 23 namespace chromeos {
24 24
25 namespace { 25 namespace {
26 26
27 class FakeTaskRunner : public base::TaskRunner { 27 class FakeTaskRunner : public base::TaskRunner {
28 public: 28 public:
29 bool PostDelayedTask(const tracked_objects::Location& from_here, 29 bool PostDelayedTask(const tracked_objects::Location& from_here,
30 const base::Closure& task, 30 base::OnceClosure task,
31 base::TimeDelta delay) override { 31 base::TimeDelta delay) override {
32 task.Run(); 32 std::move(task).Run();
33 return true; 33 return true;
34 } 34 }
35 bool RunsTasksOnCurrentThread() const override { return true; } 35 bool RunsTasksOnCurrentThread() const override { return true; }
36 36
37 protected: 37 protected:
38 ~FakeTaskRunner() override {} 38 ~FakeTaskRunner() override {}
39 }; 39 };
40 40
41 } // namespace 41 } // namespace
42 42
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // Check the response. 129 // Check the response.
130 ASSERT_TRUE(response.get()); 130 ASSERT_TRUE(response.get());
131 dbus::MessageReader reader(response.get()); 131 dbus::MessageReader reader(response.get());
132 std::string text_message; 132 std::string text_message;
133 ASSERT_TRUE(reader.PopString(&text_message)); 133 ASSERT_TRUE(reader.PopString(&text_message));
134 // The text message should be echo'ed back. 134 // The text message should be echo'ed back.
135 EXPECT_EQ(kHello, text_message); 135 EXPECT_EQ(kHello, text_message);
136 } 136 }
137 137
138 } // namespace chromeos 138 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromecast/base/system_time_change_notifier_unittest.cc ('k') | chromeos/tpm/tpm_token_info_getter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698