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

Side by Side Diff: components/arc/arc_bridge_service_unittest.cc

Issue 2211473003: Remove calls to deprecated MessageLoop methods on Windows and Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <memory> 5 #include <memory>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "base/single_thread_task_runner.h"
12 #include "chromeos/dbus/dbus_thread_manager.h" 13 #include "chromeos/dbus/dbus_thread_manager.h"
13 #include "components/arc/arc_bridge_service_impl.h" 14 #include "components/arc/arc_bridge_service_impl.h"
14 #include "components/arc/test/fake_arc_bridge_bootstrap.h" 15 #include "components/arc/test/fake_arc_bridge_bootstrap.h"
15 #include "components/arc/test/fake_arc_bridge_instance.h" 16 #include "components/arc/test/fake_arc_bridge_instance.h"
16 #include "mojo/public/cpp/system/message_pipe.h" 17 #include "mojo/public/cpp/system/message_pipe.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 19
19 namespace arc { 20 namespace arc {
20 21
21 namespace { 22 namespace {
22 23
23 class DummyObserver : public ArcBridgeService::Observer {}; 24 class DummyObserver : public ArcBridgeService::Observer {};
24 25
25 } // namespace 26 } // namespace
26 27
27 class ArcBridgeTest : public testing::Test, public ArcBridgeService::Observer { 28 class ArcBridgeTest : public testing::Test, public ArcBridgeService::Observer {
28 public: 29 public:
29 ArcBridgeTest() : ready_(false) {} 30 ArcBridgeTest() : ready_(false) {}
30 ~ArcBridgeTest() override {} 31 ~ArcBridgeTest() override {}
31 32
32 void OnBridgeReady() override { 33 void OnBridgeReady() override {
33 state_ = ArcBridgeService::State::READY; 34 state_ = ArcBridgeService::State::READY;
34 ready_ = true; 35 ready_ = true;
35 } 36 }
36 37
37 void OnBridgeStopped(ArcBridgeService::StopReason stop_reason) override { 38 void OnBridgeStopped(ArcBridgeService::StopReason stop_reason) override {
38 state_ = ArcBridgeService::State::STOPPED; 39 state_ = ArcBridgeService::State::STOPPED;
39 stop_reason_ = stop_reason; 40 stop_reason_ = stop_reason;
40 message_loop_.PostTask(FROM_HERE, message_loop_.QuitWhenIdleClosure()); 41 message_loop_.task_runner()->PostTask(FROM_HERE,
42 message_loop_.QuitWhenIdleClosure());
41 } 43 }
42 44
43 bool ready() const { return ready_; } 45 bool ready() const { return ready_; }
44 ArcBridgeService::State state() const { return state_; } 46 ArcBridgeService::State state() const { return state_; }
45 47
46 protected: 48 protected:
47 std::unique_ptr<ArcBridgeServiceImpl> service_; 49 std::unique_ptr<ArcBridgeServiceImpl> service_;
48 std::unique_ptr<FakeArcBridgeInstance> instance_; 50 std::unique_ptr<FakeArcBridgeInstance> instance_;
49 ArcBridgeService::StopReason stop_reason_; 51 ArcBridgeService::StopReason stop_reason_;
50 52
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 163 }
162 164
163 // Removing an unknown observer should be allowed. 165 // Removing an unknown observer should be allowed.
164 TEST_F(ArcBridgeTest, RemoveUnknownObserver) { 166 TEST_F(ArcBridgeTest, RemoveUnknownObserver) {
165 ASSERT_FALSE(ready()); 167 ASSERT_FALSE(ready());
166 auto dummy_observer = base::MakeUnique<DummyObserver>(); 168 auto dummy_observer = base::MakeUnique<DummyObserver>();
167 service_->RemoveObserver(dummy_observer.get()); 169 service_->RemoveObserver(dummy_observer.get());
168 } 170 }
169 171
170 } // namespace arc 172 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/server/chromedriver_server.cc ('k') | components/arc/standalone/arc_standalone_bridge_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698