OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "sync/test/engine/mock_connection_manager.h" | 7 #include "sync/test/engine/mock_connection_manager.h" |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 const GetUpdatesMessage& gu = csm->get_updates(); | 489 const GetUpdatesMessage& gu = csm->get_updates(); |
490 num_get_updates_requests_++; | 490 num_get_updates_requests_++; |
491 EXPECT_FALSE(gu.has_from_timestamp()); | 491 EXPECT_FALSE(gu.has_from_timestamp()); |
492 EXPECT_FALSE(gu.has_requested_types()); | 492 EXPECT_FALSE(gu.has_requested_types()); |
493 | 493 |
494 if (fail_non_periodic_get_updates_) { | 494 if (fail_non_periodic_get_updates_) { |
495 EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::PERIODIC, | 495 EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::PERIODIC, |
496 gu.caller_info().source()); | 496 gu.caller_info().source()); |
497 } | 497 } |
498 | 498 |
499 // Verify that the GetUpdates filter sent by the Syncer matches the test | |
500 // expectation. | |
501 ModelTypeSet protocol_types = ProtocolTypes(); | |
502 for (ModelTypeSet::Iterator iter = protocol_types.First(); iter.Good(); | |
503 iter.Inc()) { | |
504 ModelType model_type = iter.Get(); | |
505 sync_pb::DataTypeProgressMarker const* progress_marker = | |
506 GetProgressMarkerForType(gu.from_progress_marker(), model_type); | |
507 EXPECT_EQ(expected_filter_.Has(model_type), (progress_marker != NULL)) | |
508 << "Syncer requested_types differs from test expectation."; | |
509 } | |
510 | |
511 // Verify that the items we're about to send back to the client are of | 499 // Verify that the items we're about to send back to the client are of |
512 // the types requested by the client. If this fails, it probably indicates | 500 // the types requested by the client. If this fails, it probably indicates |
513 // a test bug. | 501 // a test bug. |
514 EXPECT_TRUE(gu.fetch_folders()); | 502 EXPECT_TRUE(gu.fetch_folders()); |
515 EXPECT_FALSE(gu.has_requested_types()); | 503 EXPECT_FALSE(gu.has_requested_types()); |
516 if (update_queue_.empty()) { | 504 if (update_queue_.empty()) { |
517 GetUpdateResponse(); | 505 GetUpdateResponse(); |
518 } | 506 } |
519 sync_pb::GetUpdatesResponse* updates = &update_queue_.front(); | 507 sync_pb::GetUpdatesResponse* updates = &update_queue_.front(); |
520 for (int i = 0; i < updates->entries_size(); ++i) { | 508 for (int i = 0; i < updates->entries_size(); ++i) { |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 server_status_ = HttpResponse::SERVER_CONNECTION_OK; | 716 server_status_ = HttpResponse::SERVER_CONNECTION_OK; |
729 } | 717 } |
730 } | 718 } |
731 | 719 |
732 void MockConnectionManager::SetServerStatus( | 720 void MockConnectionManager::SetServerStatus( |
733 HttpResponse::ServerConnectionCode server_status) { | 721 HttpResponse::ServerConnectionCode server_status) { |
734 server_status_ = server_status; | 722 server_status_ = server_status; |
735 } | 723 } |
736 | 724 |
737 } // namespace syncer | 725 } // namespace syncer |
OLD | NEW |