OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/invalidation/impl/gcm_invalidation_bridge.h" | 5 #include "components/invalidation/impl/gcm_invalidation_bridge.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 token_service_->UpdateCredentials("", "fake_refresh_token"); | 58 token_service_->UpdateCredentials("", "fake_refresh_token"); |
59 gcm_driver_.reset(new CustomFakeGCMDriver()); | 59 gcm_driver_.reset(new CustomFakeGCMDriver()); |
60 | 60 |
61 identity_provider_.reset(new FakeIdentityProvider(token_service_.get())); | 61 identity_provider_.reset(new FakeIdentityProvider(token_service_.get())); |
62 bridge_.reset(new GCMInvalidationBridge(gcm_driver_.get(), | 62 bridge_.reset(new GCMInvalidationBridge(gcm_driver_.get(), |
63 identity_provider_.get())); | 63 identity_provider_.get())); |
64 | 64 |
65 delegate_ = bridge_->CreateDelegate(); | 65 delegate_ = bridge_->CreateDelegate(); |
66 delegate_->Initialize( | 66 delegate_->Initialize( |
67 base::Bind(&GCMInvalidationBridgeTest::ConnectionStateChanged, | 67 base::Bind(&GCMInvalidationBridgeTest::ConnectionStateChanged, |
68 base::Unretained(this))); | 68 base::Unretained(this)), |
| 69 base::Bind(&base::DoNothing) /* store_reset_callback */); |
69 RunLoop(); | 70 RunLoop(); |
70 } | 71 } |
71 | 72 |
72 void RunLoop() { | 73 void RunLoop() { |
73 base::RunLoop run_loop; | 74 base::RunLoop run_loop; |
74 run_loop.RunUntilIdle(); | 75 run_loop.RunUntilIdle(); |
75 } | 76 } |
76 | 77 |
77 public: | 78 public: |
78 void RegisterFinished(const std::string& registration_id, | 79 void RegisterFinished(const std::string& registration_id, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 bridge_->OnConnected(net::IPEndPoint()); | 152 bridge_->OnConnected(net::IPEndPoint()); |
152 RunLoop(); | 153 RunLoop(); |
153 EXPECT_TRUE(connection_online_); | 154 EXPECT_TRUE(connection_online_); |
154 bridge_->OnDisconnected(); | 155 bridge_->OnDisconnected(); |
155 RunLoop(); | 156 RunLoop(); |
156 EXPECT_FALSE(connection_online_); | 157 EXPECT_FALSE(connection_online_); |
157 } | 158 } |
158 | 159 |
159 } // namespace | 160 } // namespace |
160 } // namespace invalidation | 161 } // namespace invalidation |
OLD | NEW |