| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/sync/test/engine/mock_connection_manager.h" | 7 #include "chrome/browser/sync/test/engine/mock_connection_manager.h" |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::PERIODIC, | 357 EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::PERIODIC, |
| 358 gu.caller_info().source()); | 358 gu.caller_info().source()); |
| 359 } | 359 } |
| 360 | 360 |
| 361 // Verify that the GetUpdates filter sent by the Syncer matches the test | 361 // Verify that the GetUpdates filter sent by the Syncer matches the test |
| 362 // expectation. | 362 // expectation. |
| 363 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { | 363 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { |
| 364 ModelType model_type = syncable::ModelTypeFromInt(i); | 364 ModelType model_type = syncable::ModelTypeFromInt(i); |
| 365 sync_pb::DataTypeProgressMarker const* progress_marker = | 365 sync_pb::DataTypeProgressMarker const* progress_marker = |
| 366 GetProgressMarkerForType(gu.from_progress_marker(), model_type); | 366 GetProgressMarkerForType(gu.from_progress_marker(), model_type); |
| 367 EXPECT_EQ(expected_filter_[i], (progress_marker != NULL)) | 367 EXPECT_EQ(expected_filter_.Has(model_type), (progress_marker != NULL)) |
| 368 << "Syncer requested_types differs from test expectation."; | 368 << "Syncer requested_types differs from test expectation."; |
| 369 if (progress_marker) { | 369 if (progress_marker) { |
| 370 EXPECT_EQ((expected_payloads_.count(model_type) > 0 ? | 370 EXPECT_EQ((expected_payloads_.count(model_type) > 0 ? |
| 371 expected_payloads_[model_type] : | 371 expected_payloads_[model_type] : |
| 372 std::string()), | 372 std::string()), |
| 373 progress_marker->notification_hint()); | 373 progress_marker->notification_hint()); |
| 374 } | 374 } |
| 375 } | 375 } |
| 376 | 376 |
| 377 // Verify that the items we're about to send back to the client are of | 377 // Verify that the items we're about to send back to the client are of |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 } | 615 } |
| 616 | 616 |
| 617 void MockConnectionManager::SetServerNotReachable() { | 617 void MockConnectionManager::SetServerNotReachable() { |
| 618 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE; | 618 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE; |
| 619 server_reachable_ = false; | 619 server_reachable_ = false; |
| 620 | 620 |
| 621 FOR_EACH_OBSERVER(ServerConnectionEventListener, listeners_, | 621 FOR_EACH_OBSERVER(ServerConnectionEventListener, listeners_, |
| 622 OnServerConnectionEvent( | 622 OnServerConnectionEvent( |
| 623 ServerConnectionEvent(server_status_, server_reachable_))); | 623 ServerConnectionEvent(server_status_, server_reachable_))); |
| 624 } | 624 } |
| OLD | NEW |