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: google_apis/gcm/engine/fake_connection_factory.cc

Issue 160703002: [GCM] Track connection failures properly (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "google_apis/gcm/engine/fake_connection_factory.h" 5 #include "google_apis/gcm/engine/fake_connection_factory.h"
6 6
7 #include "google_apis/gcm/engine/fake_connection_handler.h" 7 #include "google_apis/gcm/engine/fake_connection_handler.h"
8 #include "google_apis/gcm/protocol/mcs.pb.h" 8 #include "google_apis/gcm/protocol/mcs.pb.h"
9 #include "net/socket/stream_socket.h" 9 #include "net/socket/stream_socket.h"
10 10
11 namespace gcm { 11 namespace gcm {
12 12
13 FakeConnectionFactory::FakeConnectionFactory() { 13 FakeConnectionFactory::FakeConnectionFactory()
14 : reconnect_pending_(false),
15 delay_reconnect_(false) {
14 } 16 }
15 17
16 FakeConnectionFactory::~FakeConnectionFactory() { 18 FakeConnectionFactory::~FakeConnectionFactory() {
17 } 19 }
18 20
19 void FakeConnectionFactory::Initialize( 21 void FakeConnectionFactory::Initialize(
20 const BuildLoginRequestCallback& request_builder, 22 const BuildLoginRequestCallback& request_builder,
21 const ConnectionHandler::ProtoReceivedCallback& read_callback, 23 const ConnectionHandler::ProtoReceivedCallback& read_callback,
22 const ConnectionHandler::ProtoSentCallback& write_callback) { 24 const ConnectionHandler::ProtoSentCallback& write_callback) {
23 request_builder_ = request_builder; 25 request_builder_ = request_builder;
(...skipping 12 matching lines...) Expand all
36 } 38 }
37 39
38 bool FakeConnectionFactory::IsEndpointReachable() const { 40 bool FakeConnectionFactory::IsEndpointReachable() const {
39 return connection_handler_.get() && connection_handler_->CanSendMessage(); 41 return connection_handler_.get() && connection_handler_->CanSendMessage();
40 } 42 }
41 43
42 base::TimeTicks FakeConnectionFactory::NextRetryAttempt() const { 44 base::TimeTicks FakeConnectionFactory::NextRetryAttempt() const {
43 return base::TimeTicks(); 45 return base::TimeTicks();
44 } 46 }
45 47
46 void FakeConnectionFactory::SignalConnectionReset() { 48 void FakeConnectionFactory::SignalConnectionReset(
47 Connect(); 49 ConnectionResetReason reason) {
50 if (!delay_reconnect_)
51 Connect();
52 else
53 reconnect_pending_ = true;
48 } 54 }
49 55
50 } // namespace gcm 56 } // namespace gcm
OLDNEW
« no previous file with comments | « google_apis/gcm/engine/fake_connection_factory.h ('k') | google_apis/gcm/engine/fake_connection_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698