OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_TEST_SYNC_ENGINE_SYNCER_COMMAND_TEST_H_ | 5 #ifndef CHROME_TEST_SYNC_ENGINE_SYNCER_COMMAND_TEST_H_ |
6 #define CHROME_TEST_SYNC_ENGINE_SYNCER_COMMAND_TEST_H_ | 6 #define CHROME_TEST_SYNC_ENGINE_SYNCER_COMMAND_TEST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 const base::TimeDelta& new_interval) { | 41 const base::TimeDelta& new_interval) { |
42 FAIL() << "Should not get poll interval update."; | 42 FAIL() << "Should not get poll interval update."; |
43 } | 43 } |
44 virtual void OnReceivedShortPollIntervalUpdate( | 44 virtual void OnReceivedShortPollIntervalUpdate( |
45 const base::TimeDelta& new_interval) { | 45 const base::TimeDelta& new_interval) { |
46 FAIL() << "Should not get poll interval update."; | 46 FAIL() << "Should not get poll interval update."; |
47 } | 47 } |
48 virtual void OnShouldStopSyncingPermanently() { | 48 virtual void OnShouldStopSyncingPermanently() { |
49 FAIL() << "Shouldn't be forced to stop syncing."; | 49 FAIL() << "Shouldn't be forced to stop syncing."; |
50 } | 50 } |
| 51 virtual void SignalUpdatedToken(const std::string& token) { |
| 52 FAIL() << "Should never update token."; |
| 53 } |
51 | 54 |
52 // ModelSafeWorkerRegistrar implementation. | 55 // ModelSafeWorkerRegistrar implementation. |
53 virtual void GetWorkers(std::vector<ModelSafeWorker*>* out) { | 56 virtual void GetWorkers(std::vector<ModelSafeWorker*>* out) { |
54 std::vector<scoped_refptr<ModelSafeWorker> >::iterator it; | 57 std::vector<scoped_refptr<ModelSafeWorker> >::iterator it; |
55 for (it = workers_.begin(); it != workers_.end(); ++it) | 58 for (it = workers_.begin(); it != workers_.end(); ++it) |
56 out->push_back(*it); | 59 out->push_back(*it); |
57 } | 60 } |
58 virtual void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) { | 61 virtual void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) { |
59 ModelSafeRoutingInfo copy(routing_info_); | 62 ModelSafeRoutingInfo copy(routing_info_); |
60 out->swap(copy); | 63 out->swap(copy); |
(...skipping 23 matching lines...) Expand all Loading... |
84 if (!session_.get()) | 87 if (!session_.get()) |
85 session_.reset(new sessions::SyncSession(context(), delegate())); | 88 session_.reset(new sessions::SyncSession(context(), delegate())); |
86 return session_.get(); | 89 return session_.get(); |
87 } | 90 } |
88 void ClearSession() { | 91 void ClearSession() { |
89 session_.reset(); | 92 session_.reset(); |
90 } | 93 } |
91 | 94 |
92 void ResetContext() { | 95 void ResetContext() { |
93 context_.reset(new sessions::SyncSessionContext( | 96 context_.reset(new sessions::SyncSessionContext( |
94 mock_server_.get(), NULL, syncdb_->manager(), registrar())); | 97 mock_server_.get(), syncdb_->manager(), registrar())); |
95 context_->set_account_name(syncdb_->name()); | 98 context_->set_account_name(syncdb_->name()); |
96 ClearSession(); | 99 ClearSession(); |
97 } | 100 } |
98 | 101 |
99 // Install a MockServerConnection. Resets the context. By default, | 102 // Install a MockServerConnection. Resets the context. By default, |
100 // the context does not have a MockServerConnection attached. | 103 // the context does not have a MockServerConnection attached. |
101 void ConfigureMockServerConnection() { | 104 void ConfigureMockServerConnection() { |
102 mock_server_.reset( | 105 mock_server_.reset( |
103 new MockConnectionManager(syncdb_->manager(), syncdb_->name())); | 106 new MockConnectionManager(syncdb_->manager(), syncdb_->name())); |
104 ResetContext(); | 107 ResetContext(); |
(...skipping 29 matching lines...) Expand all Loading... |
134 : SyncerCommandTestWithParam<void*>( | 137 : SyncerCommandTestWithParam<void*>( |
135 SyncerCommandTestWithParam<void*>::USE_MOCK_DIRECTORY) {} | 138 SyncerCommandTestWithParam<void*>::USE_MOCK_DIRECTORY) {} |
136 MockDirectorySetterUpper::MockDirectory* mock_directory() { | 139 MockDirectorySetterUpper::MockDirectory* mock_directory() { |
137 return static_cast<MockDirectorySetterUpper*>(syncdb())->directory(); | 140 return static_cast<MockDirectorySetterUpper*>(syncdb())->directory(); |
138 } | 141 } |
139 }; | 142 }; |
140 | 143 |
141 } // namespace browser_sync | 144 } // namespace browser_sync |
142 | 145 |
143 #endif // CHROME_TEST_SYNC_ENGINE_SYNCER_COMMAND_TEST_H_ | 146 #endif // CHROME_TEST_SYNC_ENGINE_SYNCER_COMMAND_TEST_H_ |
OLD | NEW |