OLD | NEW |
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 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
15 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
16 #include "net/dns/mock_host_resolver.h" | 16 #include "net/dns/mock_host_resolver.h" |
17 #include "net/http/http_status_code.h" | 17 #include "net/http/http_status_code.h" |
18 #include "net/url_request/url_request_status.h" | 18 #include "net/url_request/url_request_status.h" |
19 #include "sync/internal_api/public/base/model_type.h" | 19 #include "sync/internal_api/public/base/model_type.h" |
20 #include "sync/protocol/sync_protocol_error.h" | 20 #include "sync/protocol/sync_protocol_error.h" |
| 21 #include "sync/test/fake_server/fake_server.h" |
21 #include "sync/test/local_sync_test_server.h" | 22 #include "sync/test/local_sync_test_server.h" |
22 | 23 |
23 | 24 |
24 class CommandLine; | 25 class CommandLine; |
25 class Profile; | 26 class Profile; |
26 class ProfileSyncServiceHarness; | 27 class ProfileSyncServiceHarness; |
27 | 28 |
28 namespace net { | 29 namespace net { |
29 class FakeURLFetcherFactory; | 30 class FakeURLFetcherFactory; |
30 class ProxyConfig; | 31 class ProxyConfig; |
(...skipping 19 matching lines...) Expand all Loading... |
50 | 51 |
51 // Tests where three or more client profiles are synced with the server. | 52 // Tests where three or more client profiles are synced with the server. |
52 // Typically, these tests create client side races and verify that sync | 53 // Typically, these tests create client side races and verify that sync |
53 // works. | 54 // works. |
54 MULTIPLE_CLIENT | 55 MULTIPLE_CLIENT |
55 }; | 56 }; |
56 | 57 |
57 // The type of server we're running against. | 58 // The type of server we're running against. |
58 enum ServerType { | 59 enum ServerType { |
59 SERVER_TYPE_UNDECIDED, | 60 SERVER_TYPE_UNDECIDED, |
60 LOCAL_PYTHON_SERVER, // The mock python server that runs locally and is | 61 LOCAL_PYTHON_SERVER, // The mock python server that runs locally and is |
61 // part of the Chromium checkout. | 62 // part of the Chromium checkout. |
62 LOCAL_LIVE_SERVER, // Some other server (maybe the real binary used by | 63 LOCAL_LIVE_SERVER, // Some other server (maybe the real binary used by |
63 // Google's sync service) that can be started on | 64 // Google's sync service) that can be started on |
64 // a per-test basis by running a command | 65 // a per-test basis by running a command |
65 EXTERNAL_LIVE_SERVER, // A remote server that the test code has no control | 66 EXTERNAL_LIVE_SERVER, // A remote server that the test code has no control |
66 // over whatsoever; cross your fingers that the | 67 // over whatsoever; cross your fingers that the |
67 // account state is initially clean. | 68 // account state is initially clean. |
| 69 IN_PROCESS_FAKE_SERVER, // The fake Sync server (FakeServer) running |
| 70 // in-process (bypassing HTTP calls). This |
| 71 // ServerType will eventually replace |
| 72 // LOCAL_PYTHON_SERVER. |
68 }; | 73 }; |
69 | 74 |
70 // NOTE: IMPORTANT the enum here should match with | 75 // NOTE: IMPORTANT the enum here should match with |
71 // the enum defined on the chromiumsync.py test server impl. | 76 // the enum defined on the chromiumsync.py test server impl. |
72 enum SyncErrorFrequency { | 77 enum SyncErrorFrequency { |
73 // Uninitialized state. | 78 // Uninitialized state. |
74 ERROR_FREQUENCY_NONE, | 79 ERROR_FREQUENCY_NONE, |
75 | 80 |
76 // Server sends the error on all requests. | 81 // Server sends the error on all requests. |
77 ERROR_FREQUENCY_ALWAYS, | 82 ERROR_FREQUENCY_ALWAYS, |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 249 |
245 // Creates Profile, Browser and ProfileSyncServiceHarness instances for | 250 // Creates Profile, Browser and ProfileSyncServiceHarness instances for |
246 // |index|. Used by SetupClients(). | 251 // |index|. Used by SetupClients(). |
247 virtual void InitializeInstance(int index); | 252 virtual void InitializeInstance(int index); |
248 | 253 |
249 // Implementations of the EnableNotifications() and DisableNotifications() | 254 // Implementations of the EnableNotifications() and DisableNotifications() |
250 // functions defined above. | 255 // functions defined above. |
251 void DisableNotificationsImpl(); | 256 void DisableNotificationsImpl(); |
252 void EnableNotificationsImpl(); | 257 void EnableNotificationsImpl(); |
253 | 258 |
| 259 // Set up the test to use the in-process fake server. This must be called |
| 260 // before SetUp(). |
| 261 // TODO(pvalenzuela): Remove this method when the C++ fake server becomes |
| 262 // the default server type. |
| 263 void UseFakeServer(); |
| 264 |
254 // GAIA account used by the test case. | 265 // GAIA account used by the test case. |
255 std::string username_; | 266 std::string username_; |
256 | 267 |
257 // GAIA password used by the test case. | 268 // GAIA password used by the test case. |
258 std::string password_; | 269 std::string password_; |
259 | 270 |
260 // Locally available plain text file in which GAIA credentials are stored. | 271 // Locally available plain text file in which GAIA credentials are stored. |
261 base::FilePath password_file_; | 272 base::FilePath password_file_; |
262 | 273 |
| 274 // The FakeServer used in tests with server type IN_PROCESS_FAKE_SERVER. |
| 275 scoped_ptr<syncer::FakeServer> fake_server_; |
| 276 |
263 private: | 277 private: |
264 // Helper to ProfileManager::CreateProfile that handles path creation. | 278 // Helper to ProfileManager::CreateProfile that handles path creation. |
265 static Profile* MakeProfile(const base::FilePath::StringType name); | 279 static Profile* MakeProfile(const base::FilePath::StringType name); |
266 | 280 |
267 // Helper method used to read GAIA credentials from a local password file | 281 // Helper method used to read GAIA credentials from a local password file |
268 // specified via the "--password-file-for-test" command line switch. | 282 // specified via the "--password-file-for-test" command line switch. |
269 // Note: The password file must be a plain text file with exactly two lines -- | 283 // Note: The password file must be a plain text file with exactly two lines -- |
270 // the username on the first line and the password on the second line. | 284 // the username on the first line and the password on the second line. |
271 void ReadPasswordFile(); | 285 void ReadPasswordFile(); |
272 | 286 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 scoped_ptr<net::URLFetcherImplFactory> factory_; | 388 scoped_ptr<net::URLFetcherImplFactory> factory_; |
375 | 389 |
376 // Number of default entries (as determined by the existing entries at setup | 390 // Number of default entries (as determined by the existing entries at setup |
377 // time on client 0). | 391 // time on client 0). |
378 size_t number_of_default_sync_items_; | 392 size_t number_of_default_sync_items_; |
379 | 393 |
380 DISALLOW_COPY_AND_ASSIGN(SyncTest); | 394 DISALLOW_COPY_AND_ASSIGN(SyncTest); |
381 }; | 395 }; |
382 | 396 |
383 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ | 397 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ |
OLD | NEW |