OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 | 401 |
402 // Verify that the GetUpdates filter sent by the Syncer matches the test | 402 // Verify that the GetUpdates filter sent by the Syncer matches the test |
403 // expectation. | 403 // expectation. |
404 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { | 404 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { |
405 ModelType model_type = ModelTypeFromInt(i); | 405 ModelType model_type = ModelTypeFromInt(i); |
406 sync_pb::DataTypeProgressMarker const* progress_marker = | 406 sync_pb::DataTypeProgressMarker const* progress_marker = |
407 GetProgressMarkerForType(gu.from_progress_marker(), model_type); | 407 GetProgressMarkerForType(gu.from_progress_marker(), model_type); |
408 EXPECT_EQ(expected_filter_.Has(model_type), (progress_marker != NULL)) | 408 EXPECT_EQ(expected_filter_.Has(model_type), (progress_marker != NULL)) |
409 << "Syncer requested_types differs from test expectation."; | 409 << "Syncer requested_types differs from test expectation."; |
410 if (progress_marker) { | 410 if (progress_marker) { |
411 EXPECT_EQ((expected_payloads_.count(model_type) > 0 ? | 411 EXPECT_EQ((expected_states_.count(model_type) > 0 ? |
412 expected_payloads_[model_type] : | 412 expected_states_[model_type].payload : |
413 std::string()), | 413 std::string()), |
414 progress_marker->notification_hint()); | 414 progress_marker->notification_hint()); |
415 } | 415 } |
416 } | 416 } |
417 | 417 |
418 // Verify that the items we're about to send back to the client are of | 418 // Verify that the items we're about to send back to the client are of |
419 // the types requested by the client. If this fails, it probably indicates | 419 // the types requested by the client. If this fails, it probably indicates |
420 // a test bug. | 420 // a test bug. |
421 EXPECT_TRUE(gu.fetch_folders()); | 421 EXPECT_TRUE(gu.fetch_folders()); |
422 EXPECT_FALSE(gu.has_requested_types()); | 422 EXPECT_FALSE(gu.has_requested_types()); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 | 599 |
600 void MockConnectionManager::UpdateConnectionStatus() { | 600 void MockConnectionManager::UpdateConnectionStatus() { |
601 if (!server_reachable_) { | 601 if (!server_reachable_) { |
602 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE; | 602 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE; |
603 } else { | 603 } else { |
604 server_status_ = HttpResponse::SERVER_CONNECTION_OK; | 604 server_status_ = HttpResponse::SERVER_CONNECTION_OK; |
605 } | 605 } |
606 } | 606 } |
607 | 607 |
608 } // namespace syncer | 608 } // namespace syncer |
OLD | NEW |