OLD | NEW |
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 "remoting/protocol/fake_connection_to_host.h" | 5 #include "remoting/protocol/fake_connection_to_host.h" |
6 | 6 |
7 #include "remoting/protocol/authenticator.h" | 7 #include "remoting/protocol/authenticator.h" |
8 #include "remoting/protocol/transport_context.h" | 8 #include "remoting/protocol/transport_context.h" |
9 | 9 |
10 namespace remoting { | 10 namespace remoting { |
11 namespace test { | 11 namespace test { |
12 | 12 |
13 FakeConnectionToHost::FakeConnectionToHost() | 13 FakeConnectionToHost::FakeConnectionToHost() |
14 : session_config_(protocol::SessionConfig::ForTest()) {} | 14 : session_config_(protocol::SessionConfig::ForTest()) {} |
15 FakeConnectionToHost::~FakeConnectionToHost() {} | 15 FakeConnectionToHost::~FakeConnectionToHost() {} |
16 | 16 |
17 void FakeConnectionToHost::set_client_stub(protocol::ClientStub* client_stub) {} | 17 void FakeConnectionToHost::set_client_stub(protocol::ClientStub* client_stub) {} |
18 | 18 |
19 void FakeConnectionToHost::set_clipboard_stub( | 19 void FakeConnectionToHost::set_clipboard_stub( |
20 protocol::ClipboardStub* clipboard_stub) {} | 20 protocol::ClipboardStub* clipboard_stub) {} |
21 | 21 |
22 void FakeConnectionToHost::set_video_stub(protocol::VideoStub* video_stub) {} | 22 void FakeConnectionToHost::set_video_stub(protocol::VideoStub* video_stub) {} |
23 | 23 |
24 void FakeConnectionToHost::set_audio_stub(protocol::AudioStub* audio_stub) {} | 24 void FakeConnectionToHost::set_audio_stub(protocol::AudioStub* audio_stub) {} |
25 | 25 |
26 void FakeConnectionToHost::Connect(scoped_ptr<protocol::Session> session, | 26 void FakeConnectionToHost::Connect( |
27 HostEventCallback* event_callback) { | 27 scoped_ptr<protocol::Session> session, |
| 28 scoped_refptr<protocol::TransportContext> transport_context, |
| 29 HostEventCallback* event_callback) { |
28 DCHECK(event_callback); | 30 DCHECK(event_callback); |
29 | 31 |
30 event_callback_ = event_callback; | 32 event_callback_ = event_callback; |
31 | 33 |
32 SetState(CONNECTING, protocol::OK); | 34 SetState(CONNECTING, protocol::OK); |
33 } | 35 } |
34 | 36 |
35 void FakeConnectionToHost::SignalStateChange(protocol::Session::State state, | 37 void FakeConnectionToHost::SignalStateChange(protocol::Session::State state, |
36 protocol::ErrorCode error) { | 38 protocol::ErrorCode error) { |
37 DCHECK(event_callback_); | 39 DCHECK(event_callback_); |
38 | 40 |
39 switch (state) { | 41 switch (state) { |
40 case protocol::Session::INITIALIZING: | 42 case protocol::Session::INITIALIZING: |
41 case protocol::Session::CONNECTING: | 43 case protocol::Session::CONNECTING: |
42 case protocol::Session::ACCEPTING: | 44 case protocol::Session::ACCEPTING: |
43 case protocol::Session::AUTHENTICATING: | 45 case protocol::Session::AUTHENTICATING: |
44 case protocol::Session::CONNECTED: | |
45 // No updates for these events. | 46 // No updates for these events. |
46 break; | 47 break; |
47 | 48 |
48 case protocol::Session::ACCEPTED: | 49 case protocol::Session::ACCEPTED: |
49 SetState(CONNECTED, error); | 50 SetState(CONNECTED, error); |
50 break; | 51 break; |
51 | 52 |
52 case protocol::Session::AUTHENTICATED: | 53 case protocol::Session::AUTHENTICATED: |
53 SetState(AUTHENTICATED, error); | 54 SetState(AUTHENTICATED, error); |
54 break; | 55 break; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 DCHECK(state == FAILED || error == protocol::OK); | 96 DCHECK(state == FAILED || error == protocol::OK); |
96 | 97 |
97 if (state != state_) { | 98 if (state != state_) { |
98 state_ = state; | 99 state_ = state; |
99 event_callback_->OnConnectionState(state_, error); | 100 event_callback_->OnConnectionState(state_, error); |
100 } | 101 } |
101 } | 102 } |
102 | 103 |
103 } // namespace test | 104 } // namespace test |
104 } // namespace remoting | 105 } // namespace remoting |
OLD | NEW |