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

Side by Side Diff: remoting/test/chromoting_connection_observer.cc

Issue 1238343002: Added ConnectionTimeObserver to calculate the times to authenticate and connect. (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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "remoting/test/chromoting_connection_observer.h"
6
7 #include "base/time/time.h"
8
9 namespace remoting {
10 namespace test {
11
12 ChromotingConnectionObserver::ChromotingConnectionObserver()
13 : current_state_(protocol::ConnectionToHost::State::INITIALIZING) {
14 state_map_ = {
15 {protocol::ConnectionToHost::State::INITIALIZING, "INITIALIZING"},
16 {protocol::ConnectionToHost::State::CONNECTING, "CONNECTING"},
17 {protocol::ConnectionToHost::State::AUTHENTICATED, "AUTHENTICATED"},
18 {protocol::ConnectionToHost::State::CONNECTED, "CONNECTED"},
19 {protocol::ConnectionToHost::State::FAILED, "FAILED"},
20 {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.
21 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
22 }
23
24 ChromotingConnectionObserver::~ChromotingConnectionObserver() {
25 }
26
27 void ChromotingConnectionObserver::ConnectionStateChanged(
28 protocol::ConnectionToHost::State state,
29 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
30 base::TimeTicks new_delta = base::TimeTicks::Now();
31
32 VLOG(1) << state_map_.at(current_state_) << " to " << state_map_.at(state)
33 << " Delta Time: " << (new_delta - delta_).InMilliseconds() << " ms";
34
35 current_state_ = state;
36 delta_ = base::TimeTicks::Now();
37 }
38
39 void ChromotingConnectionObserver::ConnectionReady(bool ready) {
40 VLOG(1) << "ChromotingConnectionObserver::ConnectionReady Called";
41 }
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.
42
43 void ChromotingConnectionObserver::RouteChanged(
44 const std::string& channel_name,
45 const protocol::TransportRoute& route) {
46 VLOG(1) << "ChromotingConnectionObserver::RouteChanged Called";
47 }
48
49 void ChromotingConnectionObserver::CapabilitiesSet(
50 const std::string& capabilities) {
51 VLOG(1) << "ChromotingConnectionObserver::CapabilitiesSet Called";
52 }
53
54 void ChromotingConnectionObserver::PairingResponseSet(
55 const protocol::PairingResponse& pairing_response) {
56 VLOG(1) << "ChromotingConnectionObserver::PairingResponseSet Called";
57 }
58
59 void ChromotingConnectionObserver::HostMessageReceived(
60 const protocol::ExtensionMessage& message) {
61 VLOG(1) << "ChromotingConnectionObserver::HostMessageReceived Called";
62 }
63
64 } // namespace test
65 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698