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

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

Issue 666133002: Standardize usage of virtual/override/final in components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 sync_system_resources_.storage()->WriteKey( 172 sync_system_resources_.storage()->WriteKey(
173 std::string(), "state", mock_storage_callback.CreateCallback()); 173 std::string(), "state", mock_storage_callback.CreateCallback());
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 ~TestSyncNetworkChannel() override {}
183 183
184 using SyncNetworkChannel::NotifyNetworkStatusChange; 184 using SyncNetworkChannel::NotifyNetworkStatusChange;
185 using SyncNetworkChannel::NotifyChannelStateChange; 185 using SyncNetworkChannel::NotifyChannelStateChange;
186 using SyncNetworkChannel::DeliverIncomingMessage; 186 using SyncNetworkChannel::DeliverIncomingMessage;
187 187
188 virtual void SendMessage(const std::string& message) override { 188 void SendMessage(const std::string& message) override {}
189 }
190 189
191 virtual void UpdateCredentials(const std::string& email, 190 void UpdateCredentials(const std::string& email,
192 const std::string& token) override { 191 const std::string& token) override {}
193 }
194 192
195 virtual int GetInvalidationClientType() override { 193 int GetInvalidationClientType() override { return 0; }
196 return 0;
197 }
198 194
199 virtual void RequestDetailedStatus( 195 void RequestDetailedStatus(
200 base::Callback<void(const base::DictionaryValue&)> callback) override { 196 base::Callback<void(const base::DictionaryValue&)> callback) override {
201 base::DictionaryValue value; 197 base::DictionaryValue value;
202 callback.Run(value); 198 callback.Run(value);
203 } 199 }
204 }; 200 };
205 201
206 class SyncNetworkChannelTest 202 class SyncNetworkChannelTest
207 : public testing::Test, 203 : public testing::Test,
208 public SyncNetworkChannel::Observer { 204 public SyncNetworkChannel::Observer {
209 protected: 205 protected:
210 SyncNetworkChannelTest() 206 SyncNetworkChannelTest()
211 : last_invalidator_state_(DEFAULT_INVALIDATION_ERROR), 207 : last_invalidator_state_(DEFAULT_INVALIDATION_ERROR),
212 connected_(false) { 208 connected_(false) {
213 network_channel_.AddObserver(this); 209 network_channel_.AddObserver(this);
214 network_channel_.AddNetworkStatusReceiver( 210 network_channel_.AddNetworkStatusReceiver(
215 invalidation::NewPermanentCallback( 211 invalidation::NewPermanentCallback(
216 this, &SyncNetworkChannelTest::OnNetworkStatusChange)); 212 this, &SyncNetworkChannelTest::OnNetworkStatusChange));
217 } 213 }
218 214
219 virtual ~SyncNetworkChannelTest() { 215 virtual ~SyncNetworkChannelTest() {
220 network_channel_.RemoveObserver(this); 216 network_channel_.RemoveObserver(this);
221 } 217 }
222 218
223 virtual void OnNetworkChannelStateChanged( 219 void OnNetworkChannelStateChanged(
224 InvalidatorState invalidator_state) override { 220 InvalidatorState invalidator_state) override {
225 last_invalidator_state_ = invalidator_state; 221 last_invalidator_state_ = invalidator_state;
226 } 222 }
227 223
228 void OnNetworkStatusChange(bool connected) { 224 void OnNetworkStatusChange(bool connected) {
229 connected_ = connected; 225 connected_ = connected;
230 } 226 }
231 227
232 TestSyncNetworkChannel network_channel_; 228 TestSyncNetworkChannel network_channel_;
233 InvalidatorState last_invalidator_state_; 229 InvalidatorState last_invalidator_state_;
(...skipping 13 matching lines...) Expand all
247 TEST_F(SyncNetworkChannelTest, NetworkStateChange) { 243 TEST_F(SyncNetworkChannelTest, NetworkStateChange) {
248 EXPECT_FALSE(connected_); 244 EXPECT_FALSE(connected_);
249 network_channel_.NotifyNetworkStatusChange(true); 245 network_channel_.NotifyNetworkStatusChange(true);
250 EXPECT_TRUE(connected_); 246 EXPECT_TRUE(connected_);
251 network_channel_.NotifyNetworkStatusChange(false); 247 network_channel_.NotifyNetworkStatusChange(false);
252 EXPECT_FALSE(connected_); 248 EXPECT_FALSE(connected_);
253 } 249 }
254 250
255 } // namespace 251 } // namespace
256 } // namespace syncer 252 } // namespace syncer
OLDNEW
« no previous file with comments | « components/invalidation/sync_system_resources.h ('k') | components/invalidation/ticl_invalidation_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698