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

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

Issue 1639023003: [arc] Don't bring up ScopedIPCSupport for unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <utility> 5 #include <utility>
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/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 scoped_ptr<ArcBridgeServiceImpl> service_; 77 scoped_ptr<ArcBridgeServiceImpl> service_;
78 scoped_ptr<FakeArcBridgeInstance> instance_; 78 scoped_ptr<FakeArcBridgeInstance> instance_;
79 79
80 private: 80 private:
81 void SetUp() override { 81 void SetUp() override {
82 chromeos::DBusThreadManager::Initialize(); 82 chromeos::DBusThreadManager::Initialize();
83 83
84 ready_ = false; 84 ready_ = false;
85 state_ = ArcBridgeService::State::STOPPED; 85 state_ = ArcBridgeService::State::STOPPED;
86 86
87 ipc_support_.reset(new IPC::ScopedIPCSupport(message_loop_.task_runner()));
88 instance_.reset(new FakeArcBridgeInstance()); 87 instance_.reset(new FakeArcBridgeInstance());
89 service_.reset(new ArcBridgeServiceImpl( 88 service_.reset(new ArcBridgeServiceImpl(
90 make_scoped_ptr(new FakeArcBridgeBootstrap(instance_.get())))); 89 make_scoped_ptr(new FakeArcBridgeBootstrap(instance_.get()))));
91 90
92 service_->AddObserver(this); 91 service_->AddObserver(this);
93 } 92 }
94 93
95 void TearDown() override { 94 void TearDown() override {
96 service_->RemoveObserver(this); 95 service_->RemoveObserver(this);
97 instance_.reset(); 96 instance_.reset();
98 service_.reset(); 97 service_.reset();
99 ipc_support_.reset();
100 98
101 chromeos::DBusThreadManager::Shutdown(); 99 chromeos::DBusThreadManager::Shutdown();
102 } 100 }
103 101
104 bool ready_; 102 bool ready_;
105 ArcBridgeService::State state_; 103 ArcBridgeService::State state_;
106 scoped_ptr<IPC::ScopedIPCSupport> ipc_support_;
107 base::MessageLoopForUI message_loop_; 104 base::MessageLoopForUI message_loop_;
108 105
109 DISALLOW_COPY_AND_ASSIGN(ArcBridgeTest); 106 DISALLOW_COPY_AND_ASSIGN(ArcBridgeTest);
110 }; 107 };
111 108
112 // Exercises the basic functionality of the ARC Bridge Service. A message from 109 // Exercises the basic functionality of the ARC Bridge Service. A message from
113 // within the instance should cause the observer to be notified. 110 // within the instance should cause the observer to be notified.
114 TEST_F(ArcBridgeTest, Basic) { 111 TEST_F(ArcBridgeTest, Basic) {
115 ASSERT_FALSE(ready()); 112 ASSERT_FALSE(ready());
116 ASSERT_EQ(ArcBridgeService::State::STOPPED, state()); 113 ASSERT_EQ(ArcBridgeService::State::STOPPED, state());
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 service_->OnChannelClosed(); 161 service_->OnChannelClosed();
165 instance_->WaitForInitCall(); 162 instance_->WaitForInitCall();
166 ASSERT_EQ(ArcBridgeService::State::READY, state()); 163 ASSERT_EQ(ArcBridgeService::State::READY, state());
167 ASSERT_EQ(2, instance_->init_calls()); 164 ASSERT_EQ(2, instance_->init_calls());
168 165
169 service_->Shutdown(); 166 service_->Shutdown();
170 ASSERT_EQ(ArcBridgeService::State::STOPPED, state()); 167 ASSERT_EQ(ArcBridgeService::State::STOPPED, state());
171 } 168 }
172 169
173 } // namespace arc 170 } // namespace arc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698