Index: remoting/test/chromoting_connection_observer.h |
diff --git a/remoting/test/chromoting_connection_observer.h b/remoting/test/chromoting_connection_observer.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4c0fcff6083375053012c7b323068dcdf1b152ac |
--- /dev/null |
+++ b/remoting/test/chromoting_connection_observer.h |
@@ -0,0 +1,51 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
joedow
2015/07/20 16:30:58
Is it intentional that you have not added this to
tonychun
2015/07/20 17:49:59
This is a partial CL. Once my changes for environm
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef REMOTING_TEST_CHROMOTING_CONNECTION_OBSERVER_H_ |
+#define REMOTING_TEST_CHROMOTING_CONNECTION_OBSERVER_H_ |
+ |
+#include <map> |
+ |
+#include "remoting/test/remote_connection_observer.h" |
+ |
+namespace remoting { |
+namespace test { |
+ |
+// Observes and calculates the time between each state change of the chromoting |
+// connection process. |
+class ChromotingConnectionObserver |
joedow
2015/07/20 16:30:58
I would probably just call this class a connection
tonychun
2015/07/20 17:49:59
Done.
|
+ : public RemoteConnectionObserver { |
+ public: |
+ ChromotingConnectionObserver(); |
+ ~ChromotingConnectionObserver() override; |
+ |
+ // RemoteConnectionObserver interface. |
+ void ConnectionStateChanged(protocol::ConnectionToHost::State state, |
+ protocol::ErrorCode error_code) override; |
+ void ConnectionReady(bool ready) override; |
+ void RouteChanged(const std::string& channel_name, |
+ const protocol::TransportRoute& route) override; |
+ void CapabilitiesSet(const std::string& capabilities) override; |
+ void PairingResponseSet( |
+ const protocol::PairingResponse& pairing_response) override; |
+ void HostMessageReceived(const protocol::ExtensionMessage& message) override; |
+ |
+ private: |
+ // Used to convert connection states to strings. |
+ std::map<protocol::ConnectionToHost::State, std::string> state_map_; |
+ |
+ // Saves the latest state the ChromotingClient is in. |
+ protocol::ConnectionToHost::State current_state_; |
+ |
+ // Used to find the time difference between subsequent calls to |
+ // ConnectionStateChanged. |
+ base::TimeTicks delta_; |
joedow
2015/07/20 16:30:58
I think this var should be renamed as delta_ isn't
tonychun
2015/07/20 17:49:59
Done.
|
+ |
+ DISALLOW_COPY_AND_ASSIGN(ChromotingConnectionObserver); |
+}; |
+ |
+} // namespace test |
+} // namespace remoting |
+ |
+#endif // REMOTING_TEST_CHROMOTING_CONNECTION_OBSERVER_H_ |