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

Side by Side Diff: remoting/test/test_chromoting_client.h

Issue 1253613002: Updated latency fixture and refactored connection helper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
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 #ifndef REMOTING_TEST_TEST_CHROMOTING_CLIENT_H_ 5 #ifndef REMOTING_TEST_TEST_CHROMOTING_CLIENT_H_
6 #define REMOTING_TEST_TEST_CHROMOTING_CLIENT_H_ 6 #define REMOTING_TEST_TEST_CHROMOTING_CLIENT_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h"
12 #include "base/observer_list.h" 13 #include "base/observer_list.h"
13 #include "remoting/client/chromoting_client.h" 14 #include "remoting/client/chromoting_client.h"
14 #include "remoting/client/client_user_interface.h" 15 #include "remoting/client/client_user_interface.h"
15 #include "remoting/protocol/clipboard_filter.h" 16 #include "remoting/protocol/clipboard_filter.h"
16 #include "remoting/protocol/cursor_shape_stub.h" 17 #include "remoting/protocol/cursor_shape_stub.h"
17 #include "remoting/test/remote_connection_observer.h" 18 #include "remoting/test/remote_connection_observer.h"
18 19
19 namespace remoting { 20 namespace remoting {
20 21
21 class ClientContext; 22 class ClientContext;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // these callbacks. The callbacks should be used for informational purposes. 65 // these callbacks. The callbacks should be used for informational purposes.
65 void AddRemoteConnectionObserver(RemoteConnectionObserver* observer); 66 void AddRemoteConnectionObserver(RemoteConnectionObserver* observer);
66 67
67 // Unregisters an observerer from notifications for remote connection events. 68 // Unregisters an observerer from notifications for remote connection events.
68 void RemoveRemoteConnectionObserver(RemoteConnectionObserver* observer); 69 void RemoveRemoteConnectionObserver(RemoteConnectionObserver* observer);
69 70
70 // Used to set a fake/mock connection object for TestChromotingClient tests. 71 // Used to set a fake/mock connection object for TestChromotingClient tests.
71 void SetConnectionToHostForTests( 72 void SetConnectionToHostForTests(
72 scoped_ptr<protocol::ConnectionToHost> connection_to_host); 73 scoped_ptr<protocol::ConnectionToHost> connection_to_host);
73 74
75 // Gets a weak pointer for this object.
76 base::WeakPtr<TestChromotingClient> GetWeakPtr() {
Sergey Ulanov 2015/07/23 19:36:55 I don't think you really need this - see my other
liaoyuke 2015/07/24 02:07:28 Done.
77 return weak_factory_.GetWeakPtr();
78 }
79
74 private: 80 private:
75 // ClientUserInterface interface. 81 // ClientUserInterface interface.
76 void OnConnectionState(protocol::ConnectionToHost::State state, 82 void OnConnectionState(protocol::ConnectionToHost::State state,
77 protocol::ErrorCode error_code) override; 83 protocol::ErrorCode error_code) override;
78 void OnConnectionReady(bool ready) override; 84 void OnConnectionReady(bool ready) override;
79 void OnRouteChanged(const std::string& channel_name, 85 void OnRouteChanged(const std::string& channel_name,
80 const protocol::TransportRoute& route) override; 86 const protocol::TransportRoute& route) override;
81 void SetCapabilities(const std::string& capabilities) override; 87 void SetCapabilities(const std::string& capabilities) override;
82 void SetPairingResponse( 88 void SetPairingResponse(
83 const protocol::PairingResponse& pairing_response) override; 89 const protocol::PairingResponse& pairing_response) override;
(...skipping 26 matching lines...) Expand all
110 116
111 // Manages the threads and task runners for |chromoting_client_|. 117 // Manages the threads and task runners for |chromoting_client_|.
112 scoped_ptr<ClientContext> client_context_; 118 scoped_ptr<ClientContext> client_context_;
113 119
114 // Processes video packets from the host. 120 // Processes video packets from the host.
115 scoped_ptr<VideoRenderer> video_renderer_; 121 scoped_ptr<VideoRenderer> video_renderer_;
116 122
117 // Used to establish an XMPP connection with the google talk service. 123 // Used to establish an XMPP connection with the google talk service.
118 scoped_ptr<XmppSignalStrategy> signal_strategy_; 124 scoped_ptr<XmppSignalStrategy> signal_strategy_;
119 125
126 // Used to weakly bind |this| to methods.
127 // NOTE: Weak pointers must be invalidated before all other member variables.
128 base::WeakPtrFactory<TestChromotingClient> weak_factory_;
129
120 DISALLOW_COPY_AND_ASSIGN(TestChromotingClient); 130 DISALLOW_COPY_AND_ASSIGN(TestChromotingClient);
121 }; 131 };
122 132
123 } // namespace test 133 } // namespace test
124 } // namespace remoting 134 } // namespace remoting
125 135
126 #endif // REMOTING_TEST_TEST_CHROMOTING_CLIENT_H_ 136 #endif // REMOTING_TEST_TEST_CHROMOTING_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698