OLD | NEW |
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/callback.h" | 9 #include "base/callback.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 namespace { | 26 namespace { |
27 | 27 |
28 class FakeTaskRunner : public base::TaskRunner { | 28 class FakeTaskRunner : public base::TaskRunner { |
29 public: | 29 public: |
30 bool PostDelayedTask(const tracked_objects::Location& from_here, | 30 bool PostDelayedTask(const tracked_objects::Location& from_here, |
31 base::OnceClosure task, | 31 base::OnceClosure task, |
32 base::TimeDelta delay) override { | 32 base::TimeDelta delay) override { |
33 std::move(task).Run(); | 33 std::move(task).Run(); |
34 return true; | 34 return true; |
35 } | 35 } |
36 bool RunsTasksOnCurrentThread() const override { return true; } | 36 bool RunsTasksInCurrentSequence() const override { return true; } |
37 | 37 |
38 protected: | 38 protected: |
39 ~FakeTaskRunner() override {} | 39 ~FakeTaskRunner() override {} |
40 }; | 40 }; |
41 | 41 |
42 } // namespace | 42 } // namespace |
43 | 43 |
44 class BlockingMethodCallerTest : public testing::Test { | 44 class BlockingMethodCallerTest : public testing::Test { |
45 public: | 45 public: |
46 BlockingMethodCallerTest() : task_runner_(new FakeTaskRunner) { | 46 BlockingMethodCallerTest() : task_runner_(new FakeTaskRunner) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // Check the response. | 130 // Check the response. |
131 ASSERT_TRUE(response.get()); | 131 ASSERT_TRUE(response.get()); |
132 dbus::MessageReader reader(response.get()); | 132 dbus::MessageReader reader(response.get()); |
133 std::string text_message; | 133 std::string text_message; |
134 ASSERT_TRUE(reader.PopString(&text_message)); | 134 ASSERT_TRUE(reader.PopString(&text_message)); |
135 // The text message should be echo'ed back. | 135 // The text message should be echo'ed back. |
136 EXPECT_EQ(kHello, text_message); | 136 EXPECT_EQ(kHello, text_message); |
137 } | 137 } |
138 | 138 |
139 } // namespace chromeos | 139 } // namespace chromeos |
OLD | NEW |