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 16 matching lines...) Expand all Loading... |
27 using sync_pb::SyncEnums; | 27 using sync_pb::SyncEnums; |
28 | 28 |
29 namespace syncer { | 29 namespace syncer { |
30 | 30 |
31 using syncable::WriteTransaction; | 31 using syncable::WriteTransaction; |
32 | 32 |
33 static char kValidAuthToken[] = "AuthToken"; | 33 static char kValidAuthToken[] = "AuthToken"; |
34 static char kCacheGuid[] = "kqyg7097kro6GSUod+GSg=="; | 34 static char kCacheGuid[] = "kqyg7097kro6GSUod+GSg=="; |
35 | 35 |
36 MockConnectionManager::MockConnectionManager(syncable::Directory* directory) | 36 MockConnectionManager::MockConnectionManager(syncable::Directory* directory) |
37 : ServerConnectionManager("unused", 0, false), | 37 : ServerConnectionManager("unused", 0, false, false), |
38 server_reachable_(true), | 38 server_reachable_(true), |
39 conflict_all_commits_(false), | 39 conflict_all_commits_(false), |
40 conflict_n_commits_(0), | 40 conflict_n_commits_(0), |
41 next_new_id_(10000), | 41 next_new_id_(10000), |
42 store_birthday_("Store BDay!"), | 42 store_birthday_("Store BDay!"), |
43 store_birthday_sent_(false), | 43 store_birthday_sent_(false), |
44 client_stuck_(false), | 44 client_stuck_(false), |
45 countdown_to_postbuffer_fail_(0), | 45 countdown_to_postbuffer_fail_(0), |
46 directory_(directory), | 46 directory_(directory), |
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 next_position_in_parent_(2), | 51 next_position_in_parent_(2), |
52 use_legacy_bookmarks_protocol_(false), | 52 use_legacy_bookmarks_protocol_(false), |
53 num_get_updates_requests_(0) { | 53 num_get_updates_requests_(0) { |
54 SetNewTimestamp(0); | 54 SetNewTimestamp(0); |
55 SetAuthToken(kValidAuthToken, base::Time()); | 55 SetAuthToken(kValidAuthToken); |
56 } | 56 } |
57 | 57 |
58 MockConnectionManager::~MockConnectionManager() { | 58 MockConnectionManager::~MockConnectionManager() { |
59 EXPECT_TRUE(update_queue_.empty()) << "Unfetched updates."; | 59 EXPECT_TRUE(update_queue_.empty()) << "Unfetched updates."; |
60 } | 60 } |
61 | 61 |
62 void MockConnectionManager::SetCommitTimeRename(string prepend) { | 62 void MockConnectionManager::SetCommitTimeRename(string prepend) { |
63 commit_time_rename_prepended_string_ = prepend; | 63 commit_time_rename_prepended_string_ = prepend; |
64 } | 64 } |
65 | 65 |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 | 727 |
728 void MockConnectionManager::UpdateConnectionStatus() { | 728 void MockConnectionManager::UpdateConnectionStatus() { |
729 if (!server_reachable_) { | 729 if (!server_reachable_) { |
730 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE; | 730 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE; |
731 } else { | 731 } else { |
732 server_status_ = HttpResponse::SERVER_CONNECTION_OK; | 732 server_status_ = HttpResponse::SERVER_CONNECTION_OK; |
733 } | 733 } |
734 } | 734 } |
735 | 735 |
736 } // namespace syncer | 736 } // namespace syncer |
OLD | NEW |