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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 const GetUpdatesMessage& gu = csm->get_updates(); | 490 const GetUpdatesMessage& gu = csm->get_updates(); |
491 num_get_updates_requests_++; | 491 num_get_updates_requests_++; |
492 EXPECT_FALSE(gu.has_from_timestamp()); | 492 EXPECT_FALSE(gu.has_from_timestamp()); |
493 EXPECT_FALSE(gu.has_requested_types()); | 493 EXPECT_FALSE(gu.has_requested_types()); |
494 | 494 |
495 if (fail_non_periodic_get_updates_) { | 495 if (fail_non_periodic_get_updates_) { |
496 EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::PERIODIC, | 496 EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::PERIODIC, |
497 gu.caller_info().source()); | 497 gu.caller_info().source()); |
498 } | 498 } |
499 | 499 |
500 // Verify that the GetUpdates filter sent by the Syncer matches the test | |
501 // expectation. | |
502 ModelTypeSet protocol_types = ProtocolTypes(); | |
503 for (ModelTypeSet::Iterator iter = protocol_types.First(); iter.Good(); | |
504 iter.Inc()) { | |
505 ModelType model_type = iter.Get(); | |
506 sync_pb::DataTypeProgressMarker const* progress_marker = | |
507 GetProgressMarkerForType(gu.from_progress_marker(), model_type); | |
508 EXPECT_EQ(expected_filter_.Has(model_type), (progress_marker != NULL)) | |
509 << "Syncer requested_types differs from test expectation."; | |
510 } | |
511 | |
512 // Verify that the items we're about to send back to the client are of | 500 // Verify that the items we're about to send back to the client are of |
513 // the types requested by the client. If this fails, it probably indicates | 501 // the types requested by the client. If this fails, it probably indicates |
514 // a test bug. | 502 // a test bug. |
515 EXPECT_TRUE(gu.fetch_folders()); | 503 EXPECT_TRUE(gu.fetch_folders()); |
516 EXPECT_FALSE(gu.has_requested_types()); | 504 EXPECT_FALSE(gu.has_requested_types()); |
517 if (update_queue_.empty()) { | 505 if (update_queue_.empty()) { |
518 GetUpdateResponse(); | 506 GetUpdateResponse(); |
519 } | 507 } |
520 sync_pb::GetUpdatesResponse* updates = &update_queue_.front(); | 508 sync_pb::GetUpdatesResponse* updates = &update_queue_.front(); |
521 for (int i = 0; i < updates->entries_size(); ++i) { | 509 for (int i = 0; i < updates->entries_size(); ++i) { |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 server_status_ = HttpResponse::SERVER_CONNECTION_OK; | 728 server_status_ = HttpResponse::SERVER_CONNECTION_OK; |
741 } | 729 } |
742 } | 730 } |
743 | 731 |
744 void MockConnectionManager::SetServerStatus( | 732 void MockConnectionManager::SetServerStatus( |
745 HttpResponse::ServerConnectionCode server_status) { | 733 HttpResponse::ServerConnectionCode server_status) { |
746 server_status_ = server_status; | 734 server_status_ = server_status; |
747 } | 735 } |
748 | 736 |
749 } // namespace syncer | 737 } // namespace syncer |
OLD | NEW |