Chromium Code Reviews| Index: remoting/test/connection_time_observer.h |
| diff --git a/remoting/test/connection_time_observer.h b/remoting/test/connection_time_observer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0892daf53ea08afa811f099c38741ef42726fd87 |
| --- /dev/null |
| +++ b/remoting/test/connection_time_observer.h |
| @@ -0,0 +1,39 @@ |
| +// 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. |
| + |
| +#ifndef REMOTING_TEST_CONNECTION_TIME_OBSERVER_H_ |
| +#define REMOTING_TEST_CONNECTION_TIME_OBSERVER_H_ |
| + |
| +#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. |
|
Sergey Ulanov
2015/07/20 23:04:04
And it also logs the calculated values. The purpos
tonychun
2015/07/23 03:31:04
Done.
|
| +class ConnectionTimeObserver |
| + : public RemoteConnectionObserver { |
| + public: |
| + ConnectionTimeObserver(); |
| + ~ConnectionTimeObserver() override; |
| + |
| + // RemoteConnectionObserver interface. |
| + void ConnectionStateChanged(protocol::ConnectionToHost::State state, |
| + protocol::ErrorCode error_code) override; |
| + |
| + private: |
| + // 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 last_state_change_time_ticks; |
|
Sergey Ulanov
2015/07/20 23:04:04
nit: call it last_state_change_time_ or last_state
Sergey Ulanov
2015/07/20 23:04:04
add _ at the end of the name
tonychun
2015/07/23 03:31:04
Done.
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(ConnectionTimeObserver); |
| +}; |
| + |
| +} // namespace test |
| +} // namespace remoting |
| + |
| +#endif // REMOTING_TEST_CONNECTION_TIME_OBSERVER_H_ |