Index: remoting/test/chromoting_connection_observer.cc |
diff --git a/remoting/test/chromoting_connection_observer.cc b/remoting/test/chromoting_connection_observer.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..032070de7f3f07c8fc6c2f1eb00c4b2ac8b1b14f |
--- /dev/null |
+++ b/remoting/test/chromoting_connection_observer.cc |
@@ -0,0 +1,65 @@ |
+// Copyright 2015 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. |
+ |
+#include "remoting/test/chromoting_connection_observer.h" |
+ |
+#include "base/time/time.h" |
+ |
+namespace remoting { |
+namespace test { |
+ |
+ChromotingConnectionObserver::ChromotingConnectionObserver() |
+ : current_state_(protocol::ConnectionToHost::State::INITIALIZING) { |
+ state_map_ = { |
+ {protocol::ConnectionToHost::State::INITIALIZING, "INITIALIZING"}, |
+ {protocol::ConnectionToHost::State::CONNECTING, "CONNECTING"}, |
+ {protocol::ConnectionToHost::State::AUTHENTICATED, "AUTHENTICATED"}, |
+ {protocol::ConnectionToHost::State::CONNECTED, "CONNECTED"}, |
+ {protocol::ConnectionToHost::State::FAILED, "FAILED"}, |
+ {protocol::ConnectionToHost::State::CLOSED, "CLOSED"}}; |
joedow
2015/07/20 16:30:57
I think this would be cleaner as a file-scoped fun
tonychun
2015/07/20 17:49:59
I moved it all into a switch.
|
+ delta_ = base::TimeTicks::Now(); |
joedow
2015/07/20 16:30:58
Why are you initializing this in the C'Tor? This
tonychun
2015/07/20 17:49:59
If I don't do this, I get this error:
INITIALIZIN
|
+} |
+ |
+ChromotingConnectionObserver::~ChromotingConnectionObserver() { |
+} |
+ |
+void ChromotingConnectionObserver::ConnectionStateChanged( |
+ protocol::ConnectionToHost::State state, |
+ protocol::ErrorCode error_code) { |
joedow
2015/07/20 16:30:57
Do you care about errors?
tonychun
2015/07/20 17:49:59
A log error is output already through the TestChro
|
+ base::TimeTicks new_delta = base::TimeTicks::Now(); |
+ |
+ VLOG(1) << state_map_.at(current_state_) << " to " << state_map_.at(state) |
+ << " Delta Time: " << (new_delta - delta_).InMilliseconds() << " ms"; |
+ |
+ current_state_ = state; |
+ delta_ = base::TimeTicks::Now(); |
+} |
+ |
+void ChromotingConnectionObserver::ConnectionReady(bool ready) { |
+ VLOG(1) << "ChromotingConnectionObserver::ConnectionReady Called"; |
+} |
joedow
2015/07/20 16:30:57
You don't need to implement any of these functions
tonychun
2015/07/20 17:49:59
Done.
|
+ |
+void ChromotingConnectionObserver::RouteChanged( |
+ const std::string& channel_name, |
+ const protocol::TransportRoute& route) { |
+ VLOG(1) << "ChromotingConnectionObserver::RouteChanged Called"; |
+} |
+ |
+void ChromotingConnectionObserver::CapabilitiesSet( |
+ const std::string& capabilities) { |
+ VLOG(1) << "ChromotingConnectionObserver::CapabilitiesSet Called"; |
+} |
+ |
+void ChromotingConnectionObserver::PairingResponseSet( |
+ const protocol::PairingResponse& pairing_response) { |
+ VLOG(1) << "ChromotingConnectionObserver::PairingResponseSet Called"; |
+} |
+ |
+void ChromotingConnectionObserver::HostMessageReceived( |
+ const protocol::ExtensionMessage& message) { |
+ VLOG(1) << "ChromotingConnectionObserver::HostMessageReceived Called"; |
+} |
+ |
+} // namespace test |
+} // namespace remoting |