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 <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
15 #include "base/process/process.h" | 15 #include "base/process/process.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/test/base/in_process_browser_test.h" | 17 #include "chrome/test/base/in_process_browser_test.h" |
18 #include "components/sync/base/model_type.h" | 18 #include "components/sync/base/model_type.h" |
| 19 #include "components/sync/driver/sync_service.h" |
19 #include "components/sync/protocol/sync_protocol_error.h" | 20 #include "components/sync/protocol/sync_protocol_error.h" |
20 #include "components/sync/test/fake_server/fake_server.h" | 21 #include "components/sync/test/fake_server/fake_server.h" |
21 #include "components/sync/test/local_sync_test_server.h" | 22 #include "components/sync/test/local_sync_test_server.h" |
22 #include "net/dns/mock_host_resolver.h" | 23 #include "net/dns/mock_host_resolver.h" |
23 #include "net/http/http_status_code.h" | 24 #include "net/http/http_status_code.h" |
24 #include "net/url_request/url_request_status.h" | 25 #include "net/url_request/url_request_status.h" |
25 | 26 |
26 // The E2E tests are designed to run against real backend servers. To identify | 27 // The E2E tests are designed to run against real backend servers. To identify |
27 // those tests we use *E2ETest* test name filter and run disabled tests. | 28 // those tests we use *E2ETest* test name filter and run disabled tests. |
28 // | 29 // |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // FakeServer. | 91 // FakeServer. |
91 // TODO(pvalenzuela): Delete this value when all TWO_CLIENT_LEGACY tests are | 92 // TODO(pvalenzuela): Delete this value when all TWO_CLIENT_LEGACY tests are |
92 // compatible with FakeServer and switched to TWO_CLIENT. See | 93 // compatible with FakeServer and switched to TWO_CLIENT. See |
93 // crbug.com/323265. | 94 // crbug.com/323265. |
94 TWO_CLIENT_LEGACY | 95 TWO_CLIENT_LEGACY |
95 }; | 96 }; |
96 | 97 |
97 // The type of server we're running against. | 98 // The type of server we're running against. |
98 enum ServerType { | 99 enum ServerType { |
99 SERVER_TYPE_UNDECIDED, | 100 SERVER_TYPE_UNDECIDED, |
100 LOCAL_PYTHON_SERVER, // The mock python server that runs locally and is | 101 LOCAL_PYTHON_SERVER, // The mock python server that runs locally and is |
101 // part of the Chromium checkout. | 102 // part of the Chromium checkout. |
102 LOCAL_LIVE_SERVER, // Some other server (maybe the real binary used by | 103 LOCAL_LIVE_SERVER, // Some other server (maybe the real binary used by |
103 // Google's sync service) that can be started on | 104 // Google's sync service) that can be started on |
104 // a per-test basis by running a command | 105 // a per-test basis by running a command |
105 EXTERNAL_LIVE_SERVER, // A remote server that the test code has no control | 106 EXTERNAL_LIVE_SERVER, // A remote server that the test code has no control |
106 // over whatsoever; cross your fingers that the | 107 // over whatsoever; cross your fingers that the |
107 // account state is initially clean. | 108 // account state is initially clean. |
108 IN_PROCESS_FAKE_SERVER, // The fake Sync server (FakeServer) running | 109 IN_PROCESS_FAKE_SERVER, // The fake Sync server (FakeServer) running |
109 // in-process (bypassing HTTP calls). This | 110 // in-process (bypassing HTTP calls). This |
110 // ServerType will eventually replace | 111 // ServerType will eventually replace |
111 // LOCAL_PYTHON_SERVER. | 112 // LOCAL_PYTHON_SERVER. |
112 }; | 113 }; |
113 | 114 |
114 // A SyncTest must be associated with a particular test type. | 115 // A SyncTest must be associated with a particular test type. |
115 explicit SyncTest(TestType test_type); | 116 explicit SyncTest(TestType test_type); |
116 | 117 |
117 ~SyncTest() override; | 118 ~SyncTest() override; |
118 | 119 |
119 // Validates command line parameters and creates a local python test server if | 120 // Validates command line parameters and creates a local python test server if |
120 // specified. | 121 // specified. |
121 void SetUp() override; | 122 void SetUp() override; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 186 |
186 // Kicks off encryption for profile |index|. | 187 // Kicks off encryption for profile |index|. |
187 bool EnableEncryption(int index); | 188 bool EnableEncryption(int index); |
188 | 189 |
189 // Checks if encryption is complete for profile |index|. | 190 // Checks if encryption is complete for profile |index|. |
190 bool IsEncryptionComplete(int index); | 191 bool IsEncryptionComplete(int index); |
191 | 192 |
192 // Waits until IsEncryptionComplete returns true or a timeout is reached. | 193 // Waits until IsEncryptionComplete returns true or a timeout is reached. |
193 bool AwaitEncryptionComplete(int index); | 194 bool AwaitEncryptionComplete(int index); |
194 | 195 |
| 196 // Sets the cryptographer's encryption passphrase for the profile at index |
| 197 // |index| to |passphrase|, and passphrase type |type|. |
| 198 void SetEncryptionPassphrase(int index, |
| 199 const std::string& passphrase, |
| 200 sync_driver::SyncService::PassphraseType type); |
| 201 |
| 202 // Sets the cryptographer's decryption passphrase for the profile at index |
| 203 // |index| to |passphrase|. Returns false if the operation failed, and true |
| 204 // otherwise. |
| 205 bool SetDecryptionPassphrase(int index, const std::string& passphrase); |
| 206 |
195 // Blocks until all sync clients have completed their mutual sync cycles. | 207 // Blocks until all sync clients have completed their mutual sync cycles. |
196 // Returns true if a quiescent state was successfully reached. | 208 // Returns true if a quiescent state was successfully reached. |
197 bool AwaitQuiescence(); | 209 bool AwaitQuiescence(); |
198 | 210 |
199 // Returns true if we are running tests against external servers. | 211 // Returns true if we are running tests against external servers. |
200 bool UsingExternalServers(); | 212 bool UsingExternalServers(); |
201 | 213 |
202 // Returns true if the server being used supports controlling | 214 // Returns true if the server being used supports controlling |
203 // notifications. | 215 // notifications. |
204 bool ServerSupportsNotificationControl() const; | 216 bool ServerSupportsNotificationControl() const; |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 std::unique_ptr<net::URLFetcherImplFactory> factory_; | 471 std::unique_ptr<net::URLFetcherImplFactory> factory_; |
460 | 472 |
461 // The contents to be written to a profile's Preferences file before the | 473 // The contents to be written to a profile's Preferences file before the |
462 // Profile object is created. If empty, no preexisting file will be written. | 474 // Profile object is created. If empty, no preexisting file will be written. |
463 std::string preexisting_preferences_file_contents_; | 475 std::string preexisting_preferences_file_contents_; |
464 | 476 |
465 DISALLOW_COPY_AND_ASSIGN(SyncTest); | 477 DISALLOW_COPY_AND_ASSIGN(SyncTest); |
466 }; | 478 }; |
467 | 479 |
468 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ | 480 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ |
OLD | NEW |