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

Side by Side Diff: chrome/browser/sync/test/integration/sync_test.h

Issue 650463003: Improve error triggering in sync_integration_tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ 5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_
6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // a per-test basis by running a command 87 // a per-test basis by running a command
88 EXTERNAL_LIVE_SERVER, // A remote server that the test code has no control 88 EXTERNAL_LIVE_SERVER, // A remote server that the test code has no control
89 // over whatsoever; cross your fingers that the 89 // over whatsoever; cross your fingers that the
90 // account state is initially clean. 90 // account state is initially clean.
91 IN_PROCESS_FAKE_SERVER, // The fake Sync server (FakeServer) running 91 IN_PROCESS_FAKE_SERVER, // The fake Sync server (FakeServer) running
92 // in-process (bypassing HTTP calls). This 92 // in-process (bypassing HTTP calls). This
93 // ServerType will eventually replace 93 // ServerType will eventually replace
94 // LOCAL_PYTHON_SERVER. 94 // LOCAL_PYTHON_SERVER.
95 }; 95 };
96 96
97 // NOTE: IMPORTANT the enum here should match with
98 // the enum defined on the chromiumsync.py test server impl.
99 enum SyncErrorFrequency {
100 // Uninitialized state.
101 ERROR_FREQUENCY_NONE,
102
103 // Server sends the error on all requests.
104 ERROR_FREQUENCY_ALWAYS,
105
106 // Server sends the error on two thirds of the request.
107 // Note this is not random. The server would send the
108 // error on the first 2 requests of every 3 requests.
109 ERROR_FREQUENCY_TWO_THIRDS
110 };
111
112 // A SyncTest must be associated with a particular test type. 97 // A SyncTest must be associated with a particular test type.
113 explicit SyncTest(TestType test_type); 98 explicit SyncTest(TestType test_type);
114 99
115 virtual ~SyncTest(); 100 virtual ~SyncTest();
116 101
117 // Validates command line parameters and creates a local python test server if 102 // Validates command line parameters and creates a local python test server if
118 // specified. 103 // specified.
119 virtual void SetUp() override; 104 virtual void SetUp() override;
120 105
121 // Brings down local python test server if one was created. 106 // Brings down local python test server if one was created.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 203
219 // Triggers a migration for one or more datatypes, and waits 204 // Triggers a migration for one or more datatypes, and waits
220 // for the server to complete it. This operation is available 205 // for the server to complete it. This operation is available
221 // only if ServerSupportsErrorTriggering() returned true. 206 // only if ServerSupportsErrorTriggering() returned true.
222 void TriggerMigrationDoneError(syncer::ModelTypeSet model_types); 207 void TriggerMigrationDoneError(syncer::ModelTypeSet model_types);
223 208
224 // Triggers an XMPP auth error on the server. Note the server will 209 // Triggers an XMPP auth error on the server. Note the server will
225 // stay in this state until shut down. 210 // stay in this state until shut down.
226 void TriggerXmppAuthError(); 211 void TriggerXmppAuthError();
227 212
228 // Triggers a sync error on the server.
229 // error: The error the server is expected to return.
230 // frequency: Frequency with which the error is returned.
231 void TriggerSyncError(const syncer::SyncProtocolError& error,
232 SyncErrorFrequency frequency);
233
234 // Triggers the creation the Synced Bookmarks folder on the server. 213 // Triggers the creation the Synced Bookmarks folder on the server.
235 void TriggerCreateSyncedBookmarks(); 214 void TriggerCreateSyncedBookmarks();
236 215
237 // Returns the FakeServer being used for the test or NULL if FakeServer is 216 // Returns the FakeServer being used for the test or NULL if FakeServer is
238 // not being used. 217 // not being used.
239 fake_server::FakeServer* GetFakeServer() const; 218 fake_server::FakeServer* GetFakeServer() const;
240 219
241 protected: 220 protected:
242 // Add custom switches needed for running the test. 221 // Add custom switches needed for running the test.
243 virtual void AddTestSwitches(base::CommandLine* cl); 222 virtual void AddTestSwitches(base::CommandLine* cl);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 // Fake URLFetcher factory used to mock out GAIA signin. 381 // Fake URLFetcher factory used to mock out GAIA signin.
403 scoped_ptr<net::FakeURLFetcherFactory> fake_factory_; 382 scoped_ptr<net::FakeURLFetcherFactory> fake_factory_;
404 383
405 // The URLFetcherImplFactory instance used to instantiate |fake_factory_|. 384 // The URLFetcherImplFactory instance used to instantiate |fake_factory_|.
406 scoped_ptr<net::URLFetcherImplFactory> factory_; 385 scoped_ptr<net::URLFetcherImplFactory> factory_;
407 386
408 DISALLOW_COPY_AND_ASSIGN(SyncTest); 387 DISALLOW_COPY_AND_ASSIGN(SyncTest);
409 }; 388 };
410 389
411 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ 390 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/sync_errors_test.cc ('k') | chrome/browser/sync/test/integration/sync_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698