Index: remoting/test/it2me_standalone_host.h |
diff --git a/remoting/test/it2me_standalone_host.h b/remoting/test/it2me_standalone_host.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ce10adf116535afb29a45a9391df7fb6666fd439 |
--- /dev/null |
+++ b/remoting/test/it2me_standalone_host.h |
@@ -0,0 +1,72 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
joedow
2016/05/03 22:28:30
Add header macro guard.
Hzj_jie
2016/05/04 02:11:57
Done.
|
+// An container for an it2me host by using Counter*Stub(s) to do capturing |
+// 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.
|
+ |
+#include <memory> |
+#include <string> |
+ |
+#include "base/message_loop/message_loop.h" |
+#include "base/run_loop.h" |
+#include "remoting/host/host_mock_objects.h" |
+#include "remoting/host/it2me_desktop_environment.h" |
+#include "remoting/protocol/fake_connection_to_client.h" |
+#include "remoting/test/counter_stubs.h" |
+#include "testing/gmock/include/gmock/gmock.h" |
+ |
+namespace testing { |
+template <typename MockClass> |
+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.
|
+} // namespace testing |
+ |
+namespace remoting { |
+class ChromotingHostContext; |
+class ClientSession; |
+ |
+namespace protocol { |
+class SessionConfig; |
+} // namespace protocl |
+ |
+namespace test { |
+ |
+class It2MeStandaloneHost { |
+ public: |
+ It2MeStandaloneHost(); |
+ ~It2MeStandaloneHost(); |
+ |
+ const CounterAudioStub& audio_stub() const { return audio_stub_; } |
+ const CounterClientStub& client_stub() const { return client_stub_; } |
+ const CounterHostStub& host_stub() const { return host_stub_; } |
+ const CounterVideoStub& video_stub() const { return video_stub_; } |
+ const ChromotingHostContext& context() const { return *context_; } |
+ |
+ // Block current thread forever. |
+ void Run(); |
+ |
+ private: |
+ // 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
|
+ // It2MeDesktopEnvironmentFactory->caller_task_runner(), use static method to |
+ // avoid to implement RefCounted, since we will execute run_loop_.Run() to |
+ // block the thread forever, there is no chance to destruct this instance. |
+ static void ConnectProxy(It2MeStandaloneHost* host); |
+ void Connect(); |
+ |
+ base::MessageLoopForUI message_loop_; |
+ base::RunLoop run_loop_; |
+ std::unique_ptr<ChromotingHostContext> context_; |
+ It2MeDesktopEnvironmentFactory factory_; |
+ protocol::FakeConnectionToClient connection_; |
+ std::string session_jid_; |
+ std::unique_ptr<protocol::SessionConfig> config_; |
+ CounterAudioStub audio_stub_; |
+ CounterClientStub client_stub_; |
+ CounterHostStub host_stub_; |
+ CounterVideoStub video_stub_; |
+ testing::NiceMock<MockClientSessionEventHandler> handler_; |
+ 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
|
+}; |
+ |
+} // namespace test |
+} // namespace remoting |