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/internal_api/public/test/fake_server.h" | |
20 #include "sync/protocol/sync_protocol_error.h" | 21 #include "sync/protocol/sync_protocol_error.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; |
(...skipping 28 matching lines...) Expand all Loading... | |
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 FAKE_SERVER, // The fake, in-process server (FakeServer) that | |
rlarocque
2013/12/18 20:22:01
I'm not sure if FAKE_SERVER is the best name for t
Raghu Simha
2013/12/18 22:37:12
I like the name IN_PROCESS_SERVER, but there's alr
pval...(no longer on Chromium)
2013/12/19 01:16:56
I changed this to IN_PROCESS_FAKE_SERVER so that i
pval...(no longer on Chromium)
2013/12/19 01:16:56
I think the IN_PROCESS_FAKE_SERVER naming makes it
| |
70 // will replace LOCAL_PYTHON_SERVER. | |
68 }; | 71 }; |
69 | 72 |
70 // NOTE: IMPORTANT the enum here should match with | 73 // NOTE: IMPORTANT the enum here should match with |
71 // the enum defined on the chromiumsync.py test server impl. | 74 // the enum defined on the chromiumsync.py test server impl. |
72 enum SyncErrorFrequency { | 75 enum SyncErrorFrequency { |
73 // Uninitialized state. | 76 // Uninitialized state. |
74 ERROR_FREQUENCY_NONE, | 77 ERROR_FREQUENCY_NONE, |
75 | 78 |
76 // Server sends the error on all requests. | 79 // Server sends the error on all requests. |
77 ERROR_FREQUENCY_ALWAYS, | 80 ERROR_FREQUENCY_ALWAYS, |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 | 247 |
245 // Creates Profile, Browser and ProfileSyncServiceHarness instances for | 248 // Creates Profile, Browser and ProfileSyncServiceHarness instances for |
246 // |index|. Used by SetupClients(). | 249 // |index|. Used by SetupClients(). |
247 virtual void InitializeInstance(int index); | 250 virtual void InitializeInstance(int index); |
248 | 251 |
249 // Implementations of the EnableNotifications() and DisableNotifications() | 252 // Implementations of the EnableNotifications() and DisableNotifications() |
250 // functions defined above. | 253 // functions defined above. |
251 void DisableNotificationsImpl(); | 254 void DisableNotificationsImpl(); |
252 void EnableNotificationsImpl(); | 255 void EnableNotificationsImpl(); |
253 | 256 |
257 // Set up the test to use the in-process fake server. This must be called | |
258 // before SetUp(). | |
259 // TODO(pvalenzuela): Remove this method when the C++ fake server becomes | |
260 // the default server type. | |
261 void UseFakeServer(); | |
262 | |
254 // GAIA account used by the test case. | 263 // GAIA account used by the test case. |
255 std::string username_; | 264 std::string username_; |
256 | 265 |
257 // GAIA password used by the test case. | 266 // GAIA password used by the test case. |
258 std::string password_; | 267 std::string password_; |
259 | 268 |
260 // Locally available plain text file in which GAIA credentials are stored. | 269 // Locally available plain text file in which GAIA credentials are stored. |
261 base::FilePath password_file_; | 270 base::FilePath password_file_; |
262 | 271 |
272 // The FakeServer used in tests with server type FAKE_SERVER. | |
273 scoped_ptr<syncer::FakeServer> fake_server_; | |
274 | |
263 private: | 275 private: |
264 // Helper to ProfileManager::CreateProfile that handles path creation. | 276 // Helper to ProfileManager::CreateProfile that handles path creation. |
265 static Profile* MakeProfile(const base::FilePath::StringType name); | 277 static Profile* MakeProfile(const base::FilePath::StringType name); |
266 | 278 |
267 // Helper method used to read GAIA credentials from a local password file | 279 // Helper method used to read GAIA credentials from a local password file |
268 // specified via the "--password-file-for-test" command line switch. | 280 // 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 -- | 281 // 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. | 282 // the username on the first line and the password on the second line. |
271 void ReadPasswordFile(); | 283 void ReadPasswordFile(); |
272 | 284 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
374 scoped_ptr<net::URLFetcherImplFactory> factory_; | 386 scoped_ptr<net::URLFetcherImplFactory> factory_; |
375 | 387 |
376 // Number of default entries (as determined by the existing entries at setup | 388 // Number of default entries (as determined by the existing entries at setup |
377 // time on client 0). | 389 // time on client 0). |
378 size_t number_of_default_sync_items_; | 390 size_t number_of_default_sync_items_; |
379 | 391 |
380 DISALLOW_COPY_AND_ASSIGN(SyncTest); | 392 DISALLOW_COPY_AND_ASSIGN(SyncTest); |
381 }; | 393 }; |
382 | 394 |
383 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ | 395 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ |
OLD | NEW |