OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // Mock ServerConnectionManager class for use in client regression tests. | 5 // Mock ServerConnectionManager class for use in client regression tests. |
6 | 6 |
7 #include "chrome/test/sync/engine/mock_connection_manager.h" | 7 #include "chrome/test/sync/engine/mock_connection_manager.h" |
8 | 8 |
9 #include "chrome/browser/sync/engine/syncer_proto_util.h" | 9 #include "chrome/browser/sync/engine/syncer_proto_util.h" |
10 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" | 10 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 directory_manager_(dirmgr), | 45 directory_manager_(dirmgr), |
46 directory_name_(name), | 46 directory_name_(name), |
47 mid_commit_observer_(NULL), | 47 mid_commit_observer_(NULL), |
48 throttling_(false), | 48 throttling_(false), |
49 fail_with_auth_invalid_(false), | 49 fail_with_auth_invalid_(false), |
50 fail_non_periodic_get_updates_(false), | 50 fail_non_periodic_get_updates_(false), |
51 client_command_(NULL), | 51 client_command_(NULL), |
52 next_position_in_parent_(2), | 52 next_position_in_parent_(2), |
53 use_legacy_bookmarks_protocol_(false), | 53 use_legacy_bookmarks_protocol_(false), |
54 num_get_updates_requests_(0) { | 54 num_get_updates_requests_(0) { |
55 server_reachable_ = true; | 55 server_reachable_ = true; |
| 56 SetNewTimestamp(0); |
56 }; | 57 }; |
57 | 58 |
58 MockConnectionManager::~MockConnectionManager() { | 59 MockConnectionManager::~MockConnectionManager() { |
| 60 EXPECT_TRUE(update_queue_.empty()) << "Unfetched updates."; |
59 } | 61 } |
60 | 62 |
61 void MockConnectionManager::SetCommitTimeRename(string prepend) { | 63 void MockConnectionManager::SetCommitTimeRename(string prepend) { |
62 commit_time_rename_prepended_string_ = prepend; | 64 commit_time_rename_prepended_string_ = prepend; |
63 } | 65 } |
64 | 66 |
65 void MockConnectionManager::SetMidCommitCallback(Callback0::Type* callback) { | 67 void MockConnectionManager::SetMidCommitCallback(Callback0::Type* callback) { |
66 mid_commit_callback_.reset(callback); | 68 mid_commit_callback_.reset(callback); |
67 } | 69 } |
68 | 70 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 } | 163 } |
162 | 164 |
163 bool MockConnectionManager::IsServerReachable() { | 165 bool MockConnectionManager::IsServerReachable() { |
164 return true; | 166 return true; |
165 } | 167 } |
166 | 168 |
167 bool MockConnectionManager::IsUserAuthenticated() { | 169 bool MockConnectionManager::IsUserAuthenticated() { |
168 return true; | 170 return true; |
169 } | 171 } |
170 | 172 |
171 void MockConnectionManager::ResetUpdates() { | 173 sync_pb::GetUpdatesResponse* MockConnectionManager::GetUpdateResponse() { |
172 updates_.Clear(); | 174 if (update_queue_.empty()) { |
| 175 NextUpdateBatch(); |
| 176 } |
| 177 return &update_queue_.back(); |
173 } | 178 } |
174 | 179 |
175 void MockConnectionManager::AddDefaultBookmarkData(sync_pb::SyncEntity* entity, | 180 void MockConnectionManager::AddDefaultBookmarkData(sync_pb::SyncEntity* entity, |
176 bool is_folder) { | 181 bool is_folder) { |
177 if (use_legacy_bookmarks_protocol_) { | 182 if (use_legacy_bookmarks_protocol_) { |
178 sync_pb::SyncEntity_BookmarkData* data = entity->mutable_bookmarkdata(); | 183 sync_pb::SyncEntity_BookmarkData* data = entity->mutable_bookmarkdata(); |
179 data->set_bookmark_folder(is_folder); | 184 data->set_bookmark_folder(is_folder); |
180 | 185 |
181 if (!is_folder) { | 186 if (!is_folder) { |
182 data->set_bookmark_url("http://google.com"); | 187 data->set_bookmark_url("http://google.com"); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 return AddUpdateBookmark(TestIdFactory::FromNumber(id), | 220 return AddUpdateBookmark(TestIdFactory::FromNumber(id), |
216 TestIdFactory::FromNumber(parent_id), | 221 TestIdFactory::FromNumber(parent_id), |
217 name, | 222 name, |
218 version, | 223 version, |
219 sync_ts); | 224 sync_ts); |
220 } | 225 } |
221 | 226 |
222 SyncEntity* MockConnectionManager::AddUpdateFull(string id, string parent_id, | 227 SyncEntity* MockConnectionManager::AddUpdateFull(string id, string parent_id, |
223 string name, int64 version, | 228 string name, int64 version, |
224 int64 sync_ts, bool is_dir) { | 229 int64 sync_ts, bool is_dir) { |
225 SyncEntity* ent = updates_.add_entries(); | 230 SyncEntity* ent = GetUpdateResponse()->add_entries(); |
226 ent->set_id_string(id); | 231 ent->set_id_string(id); |
227 ent->set_parent_id_string(parent_id); | 232 ent->set_parent_id_string(parent_id); |
228 ent->set_non_unique_name(name); | 233 ent->set_non_unique_name(name); |
229 ent->set_name(name); | 234 ent->set_name(name); |
230 ent->set_version(version); | 235 ent->set_version(version); |
231 ent->set_sync_timestamp(sync_ts); | 236 ent->set_sync_timestamp(sync_ts); |
232 ent->set_mtime(sync_ts); | 237 ent->set_mtime(sync_ts); |
233 ent->set_ctime(1); | 238 ent->set_ctime(1); |
234 ent->set_position_in_parent(GeneratePositionInParent()); | 239 ent->set_position_in_parent(GeneratePositionInParent()); |
235 AddDefaultBookmarkData(ent, is_dir); | 240 AddDefaultBookmarkData(ent, is_dir); |
(...skipping 19 matching lines...) Expand all Loading... |
255 SyncEntity* MockConnectionManager::AddUpdateFromLastCommit() { | 260 SyncEntity* MockConnectionManager::AddUpdateFromLastCommit() { |
256 EXPECT_EQ(1, last_sent_commit().entries_size()); | 261 EXPECT_EQ(1, last_sent_commit().entries_size()); |
257 EXPECT_EQ(1, last_commit_response().entryresponse_size()); | 262 EXPECT_EQ(1, last_commit_response().entryresponse_size()); |
258 EXPECT_EQ(CommitResponse::SUCCESS, | 263 EXPECT_EQ(CommitResponse::SUCCESS, |
259 last_commit_response().entryresponse(0).response_type()); | 264 last_commit_response().entryresponse(0).response_type()); |
260 | 265 |
261 if (last_sent_commit().entries(0).deleted()) { | 266 if (last_sent_commit().entries(0).deleted()) { |
262 AddUpdateTombstone(syncable::Id::CreateFromServerId( | 267 AddUpdateTombstone(syncable::Id::CreateFromServerId( |
263 last_sent_commit().entries(0).id_string())); | 268 last_sent_commit().entries(0).id_string())); |
264 } else { | 269 } else { |
265 SyncEntity* ent = updates_.add_entries(); | 270 SyncEntity* ent = GetUpdateResponse()->add_entries(); |
266 ent->CopyFrom(last_sent_commit().entries(0)); | 271 ent->CopyFrom(last_sent_commit().entries(0)); |
267 ent->clear_insert_after_item_id(); | 272 ent->clear_insert_after_item_id(); |
268 ent->clear_old_parent_id(); | 273 ent->clear_old_parent_id(); |
269 ent->set_position_in_parent( | 274 ent->set_position_in_parent( |
270 last_commit_response().entryresponse(0).position_in_parent()); | 275 last_commit_response().entryresponse(0).position_in_parent()); |
271 ent->set_version( | 276 ent->set_version( |
272 last_commit_response().entryresponse(0).version()); | 277 last_commit_response().entryresponse(0).version()); |
273 ent->set_id_string( | 278 ent->set_id_string( |
274 last_commit_response().entryresponse(0).id_string()); | 279 last_commit_response().entryresponse(0).id_string()); |
275 // Tests don't currently care about the following: | 280 // Tests don't currently care about the following: |
276 // originator_cache_guid, originator_client_item_id, parent_id_string, | 281 // originator_cache_guid, originator_client_item_id, parent_id_string, |
277 // name, non_unique_name. | 282 // name, non_unique_name. |
278 } | 283 } |
279 return GetMutableLastUpdate(); | 284 return GetMutableLastUpdate(); |
280 } | 285 } |
281 | 286 |
282 void MockConnectionManager::AddUpdateTombstone(const syncable::Id& id) { | 287 void MockConnectionManager::AddUpdateTombstone(const syncable::Id& id) { |
283 // Tombstones have only the ID set and dummy values for the required fields. | 288 // Tombstones have only the ID set and dummy values for the required fields. |
284 SyncEntity* ent = updates_.add_entries(); | 289 SyncEntity* ent = GetUpdateResponse()->add_entries(); |
285 ent->set_id_string(id.GetServerId()); | 290 ent->set_id_string(id.GetServerId()); |
286 ent->set_version(0); | 291 ent->set_version(0); |
287 ent->set_name(""); | 292 ent->set_name(""); |
288 ent->set_deleted(true); | 293 ent->set_deleted(true); |
289 } | 294 } |
290 | 295 |
291 void MockConnectionManager::SetLastUpdateDeleted() { | 296 void MockConnectionManager::SetLastUpdateDeleted() { |
292 // Tombstones have only the ID set. Wipe anything else. | 297 // Tombstones have only the ID set. Wipe anything else. |
293 string id_string = GetMutableLastUpdate()->id_string(); | 298 string id_string = GetMutableLastUpdate()->id_string(); |
294 updates_.mutable_entries()->RemoveLast(); | 299 GetUpdateResponse()->mutable_entries()->RemoveLast(); |
295 AddUpdateTombstone(syncable::Id::CreateFromServerId(id_string)); | 300 AddUpdateTombstone(syncable::Id::CreateFromServerId(id_string)); |
296 } | 301 } |
297 | 302 |
298 void MockConnectionManager::SetLastUpdateOriginatorFields( | 303 void MockConnectionManager::SetLastUpdateOriginatorFields( |
299 const string& client_id, | 304 const string& client_id, |
300 const string& entry_id) { | 305 const string& entry_id) { |
301 GetMutableLastUpdate()->set_originator_cache_guid(client_id); | 306 GetMutableLastUpdate()->set_originator_cache_guid(client_id); |
302 GetMutableLastUpdate()->set_originator_client_item_id(entry_id); | 307 GetMutableLastUpdate()->set_originator_client_item_id(entry_id); |
303 } | 308 } |
304 | 309 |
305 void MockConnectionManager::SetLastUpdateServerTag(const string& tag) { | 310 void MockConnectionManager::SetLastUpdateServerTag(const string& tag) { |
306 GetMutableLastUpdate()->set_server_defined_unique_tag(tag); | 311 GetMutableLastUpdate()->set_server_defined_unique_tag(tag); |
307 } | 312 } |
308 | 313 |
309 void MockConnectionManager::SetLastUpdateClientTag(const string& tag) { | 314 void MockConnectionManager::SetLastUpdateClientTag(const string& tag) { |
310 GetMutableLastUpdate()->set_client_defined_unique_tag(tag); | 315 GetMutableLastUpdate()->set_client_defined_unique_tag(tag); |
311 } | 316 } |
312 | 317 |
313 void MockConnectionManager::SetLastUpdatePosition(int64 server_position) { | 318 void MockConnectionManager::SetLastUpdatePosition(int64 server_position) { |
314 GetMutableLastUpdate()->set_position_in_parent(server_position); | 319 GetMutableLastUpdate()->set_position_in_parent(server_position); |
315 } | 320 } |
316 | 321 |
317 void MockConnectionManager::SetNewTimestamp(int64 ts) { | 322 void MockConnectionManager::SetNewTimestamp(int ts) { |
318 updates_.set_new_timestamp(ts); | 323 next_token_ = base::StringPrintf("mock connection ts = %d", ts); |
| 324 ApplyToken(); |
| 325 } |
| 326 |
| 327 void MockConnectionManager::ApplyToken() { |
| 328 if (!update_queue_.empty()) { |
| 329 GetUpdateResponse()->clear_new_progress_marker(); |
| 330 sync_pb::DataTypeProgressMarker* new_marker = |
| 331 GetUpdateResponse()->add_new_progress_marker(); |
| 332 new_marker->set_data_type_id(-1); // Invalid -- clients shouldn't see. |
| 333 new_marker->set_token(next_token_); |
| 334 } |
319 } | 335 } |
320 | 336 |
321 void MockConnectionManager::SetChangesRemaining(int64 timestamp) { | 337 void MockConnectionManager::SetChangesRemaining(int64 timestamp) { |
322 updates_.set_changes_remaining(timestamp); | 338 GetUpdateResponse()->set_changes_remaining(timestamp); |
323 } | 339 } |
324 | 340 |
325 void MockConnectionManager::ProcessGetUpdates(ClientToServerMessage* csm, | 341 void MockConnectionManager::ProcessGetUpdates(ClientToServerMessage* csm, |
326 ClientToServerResponse* response) { | 342 ClientToServerResponse* response) { |
327 CHECK(csm->has_get_updates()); | 343 CHECK(csm->has_get_updates()); |
328 ASSERT_EQ(csm->message_contents(), ClientToServerMessage::GET_UPDATES); | 344 ASSERT_EQ(csm->message_contents(), ClientToServerMessage::GET_UPDATES); |
329 const GetUpdatesMessage& gu = csm->get_updates(); | 345 const GetUpdatesMessage& gu = csm->get_updates(); |
330 num_get_updates_requests_++; | 346 num_get_updates_requests_++; |
331 EXPECT_TRUE(gu.has_from_timestamp()); | 347 EXPECT_FALSE(gu.has_from_timestamp()); |
| 348 EXPECT_FALSE(gu.has_requested_types()); |
| 349 |
332 if (fail_non_periodic_get_updates_) { | 350 if (fail_non_periodic_get_updates_) { |
333 EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::PERIODIC, | 351 EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::PERIODIC, |
334 gu.caller_info().source()); | 352 gu.caller_info().source()); |
335 } | 353 } |
336 | 354 |
337 // Verify that the GetUpdates filter sent by the Syncer matches the test | 355 // Verify that the GetUpdates filter sent by the Syncer matches the test |
338 // expectation. | 356 // expectation. |
339 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { | 357 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { |
340 ModelType model_type = syncable::ModelTypeFromInt(i); | 358 ModelType model_type = syncable::ModelTypeFromInt(i); |
341 EXPECT_EQ(expected_filter_[i], | 359 EXPECT_EQ(expected_filter_[i], |
342 IsModelTypePresentInSpecifics(gu.requested_types(), model_type)) | 360 IsModelTypePresentInSpecifics(gu.from_progress_marker(), model_type)) |
343 << "Syncer requested_types differs from test expectation."; | 361 << "Syncer requested_types differs from test expectation."; |
344 } | 362 } |
345 | 363 |
346 // Verify that the items we're about to send back to the client are of | 364 // Verify that the items we're about to send back to the client are of |
347 // the types requested by the client. If this fails, it probably indicates | 365 // the types requested by the client. If this fails, it probably indicates |
348 // a test bug. | 366 // a test bug. |
349 EXPECT_TRUE(gu.fetch_folders()); | 367 EXPECT_TRUE(gu.fetch_folders()); |
350 EXPECT_TRUE(gu.has_requested_types()); | 368 EXPECT_FALSE(gu.has_requested_types()); |
351 for (int i = 0; i < updates_.entries_size(); ++i) { | 369 if (update_queue_.empty()) { |
352 if (!updates_.entries(i).deleted()) { | 370 GetUpdateResponse(); |
353 ModelType entry_type = syncable::GetModelType(updates_.entries(i)); | 371 } |
| 372 sync_pb::GetUpdatesResponse* updates = &update_queue_.front(); |
| 373 for (int i = 0; i < updates->entries_size(); ++i) { |
| 374 if (!updates->entries(i).deleted()) { |
| 375 ModelType entry_type = syncable::GetModelType(updates->entries(i)); |
354 EXPECT_TRUE( | 376 EXPECT_TRUE( |
355 IsModelTypePresentInSpecifics(gu.requested_types(), entry_type)) | 377 IsModelTypePresentInSpecifics(gu.from_progress_marker(), entry_type)) |
356 << "Syncer did not request updates being provided by the test."; | 378 << "Syncer did not request updates being provided by the test."; |
357 } | 379 } |
358 } | 380 } |
359 | 381 |
360 // TODO(sync): filter results dependant on timestamp? or check limits? | 382 response->mutable_get_updates()->CopyFrom(*updates); |
361 response->mutable_get_updates()->CopyFrom(updates_); | 383 |
362 ResetUpdates(); | 384 // Set appropriate progress markers, overriding the value squirreled |
| 385 // away by ApplyToken(). |
| 386 std::string token = response->get_updates().new_progress_marker(0).token(); |
| 387 response->mutable_get_updates()->clear_new_progress_marker(); |
| 388 for (int i = 0; i < gu.from_progress_marker_size(); ++i) { |
| 389 if (gu.from_progress_marker(i).token() != token) { |
| 390 sync_pb::DataTypeProgressMarker* new_marker = |
| 391 response->mutable_get_updates()->add_new_progress_marker(); |
| 392 new_marker->set_data_type_id(gu.from_progress_marker(i).data_type_id()); |
| 393 new_marker->set_token(token); |
| 394 } |
| 395 } |
| 396 |
| 397 update_queue_.pop_front(); |
363 } | 398 } |
364 | 399 |
365 void MockConnectionManager::SetClearUserDataResponseStatus( | 400 void MockConnectionManager::SetClearUserDataResponseStatus( |
366 sync_pb::ClientToServerResponse::ErrorType errortype ) { | 401 sync_pb::ClientToServerResponse::ErrorType errortype ) { |
367 // Note: this is not a thread-safe set, ok for now. NOT ok if tests | 402 // Note: this is not a thread-safe set, ok for now. NOT ok if tests |
368 // run the syncer on the background thread while this method is called. | 403 // run the syncer on the background thread while this method is called. |
369 clear_user_data_response_errortype_ = errortype; | 404 clear_user_data_response_errortype_ = errortype; |
370 } | 405 } |
371 | 406 |
372 void MockConnectionManager::ProcessClearData(ClientToServerMessage* csm, | 407 void MockConnectionManager::ProcessClearData(ClientToServerMessage* csm, |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 } | 513 } |
479 | 514 |
480 SyncEntity* MockConnectionManager::AddUpdateBookmark( | 515 SyncEntity* MockConnectionManager::AddUpdateBookmark( |
481 syncable::Id id, syncable::Id parent_id, string name, int64 version, | 516 syncable::Id id, syncable::Id parent_id, string name, int64 version, |
482 int64 sync_ts) { | 517 int64 sync_ts) { |
483 return AddUpdateBookmark(id.GetServerId(), parent_id.GetServerId(), | 518 return AddUpdateBookmark(id.GetServerId(), parent_id.GetServerId(), |
484 name, version, sync_ts); | 519 name, version, sync_ts); |
485 } | 520 } |
486 | 521 |
487 SyncEntity* MockConnectionManager::GetMutableLastUpdate() { | 522 SyncEntity* MockConnectionManager::GetMutableLastUpdate() { |
488 EXPECT_TRUE(updates_.entries_size() > 0); | 523 sync_pb::GetUpdatesResponse* updates = GetUpdateResponse(); |
489 return updates_.mutable_entries()->Mutable(updates_.entries_size() - 1); | 524 EXPECT_TRUE(updates->entries_size() > 0); |
| 525 return updates->mutable_entries()->Mutable(updates->entries_size() - 1); |
| 526 } |
| 527 |
| 528 void MockConnectionManager::NextUpdateBatch() { |
| 529 update_queue_.push_back(sync_pb::GetUpdatesResponse::default_instance()); |
| 530 SetChangesRemaining(0); |
| 531 ApplyToken(); |
490 } | 532 } |
491 | 533 |
492 const CommitMessage& MockConnectionManager::last_sent_commit() const { | 534 const CommitMessage& MockConnectionManager::last_sent_commit() const { |
493 EXPECT_TRUE(!commit_messages_.empty()); | 535 EXPECT_TRUE(!commit_messages_.empty()); |
494 return *commit_messages_->back(); | 536 return *commit_messages_->back(); |
495 } | 537 } |
496 | 538 |
497 const CommitResponse& MockConnectionManager::last_commit_response() const { | 539 const CommitResponse& MockConnectionManager::last_commit_response() const { |
498 EXPECT_TRUE(!commit_responses_.empty()); | 540 EXPECT_TRUE(!commit_responses_.empty()); |
499 return *commit_responses_->back(); | 541 return *commit_responses_->back(); |
(...skipping 17 matching lines...) Expand all Loading... |
517 | 559 |
518 void MockConnectionManager::StopFailingWithAuthInvalid( | 560 void MockConnectionManager::StopFailingWithAuthInvalid( |
519 ResponseCodeOverrideRequestor* visitor) { | 561 ResponseCodeOverrideRequestor* visitor) { |
520 AutoLock lock(response_code_override_lock_); | 562 AutoLock lock(response_code_override_lock_); |
521 fail_with_auth_invalid_ = false; | 563 fail_with_auth_invalid_ = false; |
522 if (visitor) | 564 if (visitor) |
523 visitor->OnOverrideComplete(); | 565 visitor->OnOverrideComplete(); |
524 } | 566 } |
525 | 567 |
526 bool MockConnectionManager::IsModelTypePresentInSpecifics( | 568 bool MockConnectionManager::IsModelTypePresentInSpecifics( |
527 const sync_pb::EntitySpecifics& filter, syncable::ModelType value) { | 569 const google::protobuf::RepeatedPtrField< |
528 // This implementation is a little contorted; it's done this way | 570 sync_pb::DataTypeProgressMarker>& filter, |
529 // to avoid having to switch on the ModelType. We're basically doing | 571 syncable::ModelType value) { |
530 // the protobuf equivalent of ((value & filter) == filter). | 572 int data_type_id = syncable::GetExtensionFieldNumberFromModelType(value); |
531 sync_pb::EntitySpecifics value_filter; | 573 for (int i = 0; i < filter.size(); ++i) { |
532 syncable::AddDefaultExtensionValue(value, &value_filter); | 574 if (filter.Get(i).data_type_id() == data_type_id) { |
533 value_filter.MergeFrom(filter); | 575 return true; |
534 return value_filter.SerializeAsString() == filter.SerializeAsString(); | 576 } |
| 577 } |
| 578 return false; |
535 } | 579 } |
536 | 580 |
537 void MockConnectionManager::SetServerReachable() { | 581 void MockConnectionManager::SetServerReachable() { |
538 server_status_ = HttpResponse::SERVER_CONNECTION_OK; | 582 server_status_ = HttpResponse::SERVER_CONNECTION_OK; |
539 server_reachable_ = true; | 583 server_reachable_ = true; |
540 browser_sync::ServerConnectionEvent event = { | 584 browser_sync::ServerConnectionEvent event = { |
541 browser_sync::ServerConnectionEvent::STATUS_CHANGED, | 585 browser_sync::ServerConnectionEvent::STATUS_CHANGED, |
542 server_status_, | 586 server_status_, |
543 server_reachable_ }; | 587 server_reachable_ }; |
544 channel_->NotifyListeners(event); | 588 channel_->NotifyListeners(event); |
545 } | 589 } |
546 | 590 |
547 void MockConnectionManager::SetServerNotReachable() { | 591 void MockConnectionManager::SetServerNotReachable() { |
548 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE; | 592 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE; |
549 server_reachable_ = false; | 593 server_reachable_ = false; |
550 browser_sync::ServerConnectionEvent event = { | 594 browser_sync::ServerConnectionEvent event = { |
551 browser_sync::ServerConnectionEvent::STATUS_CHANGED, | 595 browser_sync::ServerConnectionEvent::STATUS_CHANGED, |
552 server_status_, | 596 server_status_, |
553 server_reachable_ }; | 597 server_reachable_ }; |
554 channel_->NotifyListeners(event); | 598 channel_->NotifyListeners(event); |
555 } | 599 } |
OLD | NEW |