Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: chrome/test/sync/engine/syncer_command_test.h

Issue 7604019: [Sync] Add client-side plumbing for server control of sessions commit delay (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile error and address comments Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/sessions/test_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #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 <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/compiler_specific.h"
13 #include "chrome/browser/sync/engine/model_safe_worker.h" 14 #include "chrome/browser/sync/engine/model_safe_worker.h"
14 #include "chrome/browser/sync/sessions/sync_session.h" 15 #include "chrome/browser/sync/sessions/sync_session.h"
15 #include "chrome/browser/sync/sessions/sync_session_context.h" 16 #include "chrome/browser/sync/sessions/sync_session_context.h"
16 #include "chrome/test/sync/engine/mock_connection_manager.h" 17 #include "chrome/test/sync/engine/mock_connection_manager.h"
17 #include "chrome/test/sync/engine/test_directory_setter_upper.h" 18 #include "chrome/test/sync/engine/test_directory_setter_upper.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 20
20 namespace browser_sync { 21 namespace browser_sync {
21 22
22 // A test fixture that simplifies writing unit tests for individual 23 // A test fixture that simplifies writing unit tests for individual
23 // SyncerCommands, providing convenient access to a test directory 24 // SyncerCommands, providing convenient access to a test directory
24 // and a syncer session. 25 // and a syncer session.
25 template<typename T> 26 template<typename T>
26 class SyncerCommandTestWithParam : public testing::TestWithParam<T>, 27 class SyncerCommandTestWithParam : public testing::TestWithParam<T>,
27 public sessions::SyncSession::Delegate, 28 public sessions::SyncSession::Delegate,
28 public ModelSafeWorkerRegistrar { 29 public ModelSafeWorkerRegistrar {
29 public: 30 public:
30 enum UseMockDirectory { 31 enum UseMockDirectory {
31 USE_MOCK_DIRECTORY 32 USE_MOCK_DIRECTORY
32 }; 33 };
33 34
34 // SyncSession::Delegate implementation. 35 // SyncSession::Delegate implementation.
35 virtual void OnSilencedUntil(const base::TimeTicks& silenced_until) { 36 virtual void OnSilencedUntil(
37 const base::TimeTicks& silenced_until) OVERRIDE {
36 FAIL() << "Should not get silenced."; 38 FAIL() << "Should not get silenced.";
37 } 39 }
38 virtual bool IsSyncingCurrentlySilenced() { 40 virtual bool IsSyncingCurrentlySilenced() OVERRIDE {
39 ADD_FAILURE() << "No requests for silenced state should be made."; 41 ADD_FAILURE() << "No requests for silenced state should be made.";
40 return false; 42 return false;
41 } 43 }
42 virtual void OnReceivedLongPollIntervalUpdate( 44 virtual void OnReceivedLongPollIntervalUpdate(
43 const base::TimeDelta& new_interval) { 45 const base::TimeDelta& new_interval) OVERRIDE {
44 FAIL() << "Should not get poll interval update."; 46 FAIL() << "Should not get poll interval update.";
45 } 47 }
46 virtual void OnReceivedShortPollIntervalUpdate( 48 virtual void OnReceivedShortPollIntervalUpdate(
47 const base::TimeDelta& new_interval) { 49 const base::TimeDelta& new_interval) OVERRIDE {
48 FAIL() << "Should not get poll interval update."; 50 FAIL() << "Should not get poll interval update.";
49 } 51 }
50 virtual void OnShouldStopSyncingPermanently() { 52 virtual void OnReceivedSessionsCommitDelay(
53 const base::TimeDelta& new_delay) OVERRIDE {
54 FAIL() << "Should not get sessions commit delay.";
55 }
56 virtual void OnShouldStopSyncingPermanently() OVERRIDE {
51 FAIL() << "Shouldn't be forced to stop syncing."; 57 FAIL() << "Shouldn't be forced to stop syncing.";
52 } 58 }
53 virtual void SignalUpdatedToken(const std::string& token) {
54 FAIL() << "Should never update token.";
55 }
56 59
57 // ModelSafeWorkerRegistrar implementation. 60 // ModelSafeWorkerRegistrar implementation.
58 virtual void GetWorkers(std::vector<ModelSafeWorker*>* out) { 61 virtual void GetWorkers(std::vector<ModelSafeWorker*>* out) OVERRIDE {
59 std::vector<scoped_refptr<ModelSafeWorker> >::iterator it; 62 std::vector<scoped_refptr<ModelSafeWorker> >::iterator it;
60 for (it = workers_.begin(); it != workers_.end(); ++it) 63 for (it = workers_.begin(); it != workers_.end(); ++it)
61 out->push_back(*it); 64 out->push_back(*it);
62 } 65 }
63 virtual void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) { 66 virtual void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) OVERRIDE {
64 ModelSafeRoutingInfo copy(routing_info_); 67 ModelSafeRoutingInfo copy(routing_info_);
65 out->swap(copy); 68 out->swap(copy);
66 } 69 }
67 70
68 protected: 71 protected:
69 SyncerCommandTestWithParam() : syncdb_(new TestDirectorySetterUpper()) {} 72 SyncerCommandTestWithParam() : syncdb_(new TestDirectorySetterUpper()) {}
70 73
71 explicit SyncerCommandTestWithParam(UseMockDirectory use_mock) 74 explicit SyncerCommandTestWithParam(UseMockDirectory use_mock)
72 : syncdb_(new MockDirectorySetterUpper()) {} 75 : syncdb_(new MockDirectorySetterUpper()) {}
73 76
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 : SyncerCommandTestWithParam<void*>( 157 : SyncerCommandTestWithParam<void*>(
155 SyncerCommandTestWithParam<void*>::USE_MOCK_DIRECTORY) {} 158 SyncerCommandTestWithParam<void*>::USE_MOCK_DIRECTORY) {}
156 MockDirectorySetterUpper::MockDirectory* mock_directory() { 159 MockDirectorySetterUpper::MockDirectory* mock_directory() {
157 return static_cast<MockDirectorySetterUpper*>(syncdb())->directory(); 160 return static_cast<MockDirectorySetterUpper*>(syncdb())->directory();
158 } 161 }
159 }; 162 };
160 163
161 } // namespace browser_sync 164 } // namespace browser_sync
162 165
163 #endif // CHROME_TEST_SYNC_ENGINE_SYNCER_COMMAND_TEST_H_ 166 #endif // CHROME_TEST_SYNC_ENGINE_SYNCER_COMMAND_TEST_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/sessions/test_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698