OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
joedow
2016/05/03 22:28:30
Add header macro guard.
Hzj_jie
2016/05/04 02:11:57
Done.
| |
5 // An container for an it2me host by using Counter*Stub(s) to do capturing | |
6 // without needing a client to connect to. | |
joedow
2016/05/03 22:28:30
I don't think this comment is needed here, you cou
Hzj_jie
2016/05/04 02:11:57
Done.
| |
7 | |
8 #include <memory> | |
9 #include <string> | |
10 | |
11 #include "base/message_loop/message_loop.h" | |
12 #include "base/run_loop.h" | |
13 #include "remoting/host/host_mock_objects.h" | |
14 #include "remoting/host/it2me_desktop_environment.h" | |
15 #include "remoting/protocol/fake_connection_to_client.h" | |
16 #include "remoting/test/counter_stubs.h" | |
17 #include "testing/gmock/include/gmock/gmock.h" | |
18 | |
19 namespace testing { | |
20 template <typename MockClass> | |
21 class NiceMock; | |
joedow
2016/05/03 22:28:30
I think you can remove this forward decl since you
Hzj_jie
2016/05/04 02:11:57
Done.
| |
22 } // namespace testing | |
23 | |
24 namespace remoting { | |
25 class ChromotingHostContext; | |
26 class ClientSession; | |
27 | |
28 namespace protocol { | |
29 class SessionConfig; | |
30 } // namespace protocl | |
31 | |
32 namespace test { | |
33 | |
34 class It2MeStandaloneHost { | |
35 public: | |
36 It2MeStandaloneHost(); | |
37 ~It2MeStandaloneHost(); | |
38 | |
39 const CounterAudioStub& audio_stub() const { return audio_stub_; } | |
40 const CounterClientStub& client_stub() const { return client_stub_; } | |
41 const CounterHostStub& host_stub() const { return host_stub_; } | |
42 const CounterVideoStub& video_stub() const { return video_stub_; } | |
43 const ChromotingHostContext& context() const { return *context_; } | |
44 | |
45 // Block current thread forever. | |
46 void Run(); | |
47 | |
48 private: | |
49 // Must run in the same thread as | |
joedow
2016/05/03 22:28:30
Should you use a thread checker to enforce this co
Hzj_jie
2016/05/04 02:11:57
Not really needed, ClientSession::OnConnectionAuth
| |
50 // It2MeDesktopEnvironmentFactory->caller_task_runner(), use static method to | |
51 // avoid to implement RefCounted, since we will execute run_loop_.Run() to | |
52 // block the thread forever, there is no chance to destruct this instance. | |
53 static void ConnectProxy(It2MeStandaloneHost* host); | |
54 void Connect(); | |
55 | |
56 base::MessageLoopForUI message_loop_; | |
57 base::RunLoop run_loop_; | |
58 std::unique_ptr<ChromotingHostContext> context_; | |
59 It2MeDesktopEnvironmentFactory factory_; | |
60 protocol::FakeConnectionToClient connection_; | |
61 std::string session_jid_; | |
62 std::unique_ptr<protocol::SessionConfig> config_; | |
63 CounterAudioStub audio_stub_; | |
64 CounterClientStub client_stub_; | |
65 CounterHostStub host_stub_; | |
66 CounterVideoStub video_stub_; | |
67 testing::NiceMock<MockClientSessionEventHandler> handler_; | |
68 std::unique_ptr<ClientSession> session_; | |
joedow
2016/05/03 22:28:30
DISALLOW_COPY_AND_ASSIGN(...)?
Hzj_jie
2016/05/04 02:11:57
Same as other classes, copy and assign are implici
| |
69 }; | |
70 | |
71 } // namespace test | |
72 } // namespace remoting | |
OLD | NEW |