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 |
| 5 #ifndef REMOTING_TEST_IT2ME_STANDALONE_HOST_H_ |
| 6 #define REMOTING_TEST_IT2ME_STANDALONE_HOST_H_ |
| 7 |
| 8 #include <memory> |
| 9 #include <string> |
| 10 |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/run_loop.h" |
| 14 #include "base/timer/timer.h" |
| 15 #include "remoting/host/host_mock_objects.h" |
| 16 #include "remoting/host/it2me_desktop_environment.h" |
| 17 #include "remoting/protocol/fake_connection_to_client.h" |
| 18 #include "remoting/test/fake_connection_event_logger.h" |
| 19 #include "testing/gmock/include/gmock/gmock.h" |
| 20 |
| 21 namespace remoting { |
| 22 class ChromotingHostContext; |
| 23 class ClientSession; |
| 24 |
| 25 namespace protocol { |
| 26 class SessionConfig; |
| 27 } // namespace protocol |
| 28 |
| 29 namespace test { |
| 30 |
| 31 // A container for an it2me host by using FakeConnectionEventLogger to do |
| 32 // capturing without needing a client to connect to. |
| 33 class It2MeStandaloneHost { |
| 34 public: |
| 35 It2MeStandaloneHost(); |
| 36 ~It2MeStandaloneHost(); |
| 37 |
| 38 // Block current thread forever. |
| 39 void Run(); |
| 40 |
| 41 void StartOutputTimer(); |
| 42 |
| 43 private: |
| 44 void Connect(); |
| 45 |
| 46 base::MessageLoopForUI message_loop_; |
| 47 base::RunLoop run_loop_; |
| 48 std::unique_ptr<ChromotingHostContext> context_; |
| 49 scoped_refptr<AutoThreadTaskRunner> main_task_runner_; |
| 50 It2MeDesktopEnvironmentFactory factory_; |
| 51 protocol::FakeConnectionToClient connection_; |
| 52 std::string session_jid_; |
| 53 std::unique_ptr<protocol::SessionConfig> config_; |
| 54 FakeConnectionEventLogger event_logger_; |
| 55 testing::NiceMock<MockClientSessionEventHandler> handler_; |
| 56 std::unique_ptr<ClientSession> session_; |
| 57 base::RepeatingTimer timer_; |
| 58 }; |
| 59 |
| 60 } // namespace test |
| 61 } // namespace remoting |
| 62 |
| 63 #endif // REMOTING_TEST_IT2ME_STANDALONE_HOST_H_ |
OLD | NEW |