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

Side by Side Diff: components/invalidation/sync_system_resources_unittest.cc

Issue 348503002: Report InvalidatorState correctly from GCMNetworkChannel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@GCM.ConnectionState
Patch Set: Rebase Created 6 years, 6 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
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/sync_system_resources.h" 5 #include "components/invalidation/sync_system_resources.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 message_loop_.RunUntilIdle(); 174 message_loop_.RunUntilIdle();
175 EXPECT_EQ(invalidation::Status(invalidation::Status::SUCCESS, std::string()), 175 EXPECT_EQ(invalidation::Status(invalidation::Status::SUCCESS, std::string()),
176 results); 176 results);
177 } 177 }
178 178
179 class TestSyncNetworkChannel : public SyncNetworkChannel { 179 class TestSyncNetworkChannel : public SyncNetworkChannel {
180 public: 180 public:
181 TestSyncNetworkChannel() {} 181 TestSyncNetworkChannel() {}
182 virtual ~TestSyncNetworkChannel() {} 182 virtual ~TestSyncNetworkChannel() {}
183 183
184 using SyncNetworkChannel::NotifyStateChange; 184 using SyncNetworkChannel::NotifyChannelStateChange;
185 using SyncNetworkChannel::DeliverIncomingMessage; 185 using SyncNetworkChannel::DeliverIncomingMessage;
186 186
187 virtual void SendMessage(const std::string& message) OVERRIDE { 187 virtual void SendMessage(const std::string& message) OVERRIDE {
188 } 188 }
189 189
190 virtual void UpdateCredentials(const std::string& email, 190 virtual void UpdateCredentials(const std::string& email,
191 const std::string& token) OVERRIDE { 191 const std::string& token) OVERRIDE {
192 } 192 }
193 193
194 virtual int GetInvalidationClientType() OVERRIDE { 194 virtual int GetInvalidationClientType() OVERRIDE {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 230
231 TestSyncNetworkChannel network_channel_; 231 TestSyncNetworkChannel network_channel_;
232 InvalidatorState last_invalidator_state_; 232 InvalidatorState last_invalidator_state_;
233 bool connected_; 233 bool connected_;
234 }; 234 };
235 235
236 // Simulate network channel state change. It should propagate to observer. 236 // Simulate network channel state change. It should propagate to observer.
237 TEST_F(SyncNetworkChannelTest, OnNetworkChannelStateChanged) { 237 TEST_F(SyncNetworkChannelTest, OnNetworkChannelStateChanged) {
238 EXPECT_EQ(DEFAULT_INVALIDATION_ERROR, last_invalidator_state_); 238 EXPECT_EQ(DEFAULT_INVALIDATION_ERROR, last_invalidator_state_);
239 EXPECT_FALSE(connected_); 239 EXPECT_FALSE(connected_);
240 network_channel_.NotifyStateChange(INVALIDATIONS_ENABLED); 240 network_channel_.NotifyChannelStateChange(INVALIDATIONS_ENABLED);
241 EXPECT_EQ(INVALIDATIONS_ENABLED, last_invalidator_state_); 241 EXPECT_EQ(INVALIDATIONS_ENABLED, last_invalidator_state_);
242 EXPECT_TRUE(connected_); 242 EXPECT_TRUE(connected_);
243 network_channel_.NotifyStateChange(INVALIDATION_CREDENTIALS_REJECTED); 243 network_channel_.NotifyChannelStateChange(INVALIDATION_CREDENTIALS_REJECTED);
244 EXPECT_EQ(INVALIDATION_CREDENTIALS_REJECTED, last_invalidator_state_); 244 EXPECT_EQ(INVALIDATION_CREDENTIALS_REJECTED, last_invalidator_state_);
245 EXPECT_FALSE(connected_); 245 EXPECT_FALSE(connected_);
246 } 246 }
247 247
248 } // namespace 248 } // namespace
249 } // namespace syncer 249 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698