OLD | NEW |
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_LIVE_SYNC_LIVE_SYNC_TEST_H_ | 5 #ifndef CHROME_TEST_LIVE_SYNC_LIVE_SYNC_TEST_H_ |
6 #define CHROME_TEST_LIVE_SYNC_LIVE_SYNC_TEST_H_ | 6 #define CHROME_TEST_LIVE_SYNC_LIVE_SYNC_TEST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
10 | 10 |
| 11 #include <string> |
| 12 #include <vector> |
| 13 |
11 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
12 #include "base/file_util.h" | 15 #include "base/file_util.h" |
13 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/scoped_vector.h" | 17 #include "base/memory/scoped_vector.h" |
15 #include "base/process_util.h" | 18 #include "base/process_util.h" |
16 #include "chrome/browser/sync/syncable/model_type.h" | 19 #include "chrome/browser/sync/syncable/model_type.h" |
17 #include "net/base/mock_host_resolver.h" | 20 #include "net/base/mock_host_resolver.h" |
18 #include "net/test/test_server.h" | 21 #include "net/test/test_server.h" |
19 | 22 |
20 #include <string> | |
21 #include <vector> | |
22 | |
23 class CommandLine; | 23 class CommandLine; |
24 class Profile; | 24 class Profile; |
25 class ProfileSyncServiceHarness; | 25 class ProfileSyncServiceHarness; |
26 class FakeURLFetcherFactory; | 26 class FakeURLFetcherFactory; |
27 class URLFetcherFactory; | 27 class URLFetcherFactory; |
28 | 28 |
29 namespace net { | 29 namespace net { |
30 class ProxyConfig; | 30 class ProxyConfig; |
31 class ScopedDefaultHostResolverProc; | 31 class ScopedDefaultHostResolverProc; |
32 class URLRequestContextGetter; | 32 class URLRequestContextGetter; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // account state is initially clean. | 70 // account state is initially clean. |
71 }; | 71 }; |
72 | 72 |
73 // A LiveSyncTest must be associated with a particular test type. | 73 // A LiveSyncTest must be associated with a particular test type. |
74 explicit LiveSyncTest(TestType test_type); | 74 explicit LiveSyncTest(TestType test_type); |
75 | 75 |
76 virtual ~LiveSyncTest(); | 76 virtual ~LiveSyncTest(); |
77 | 77 |
78 // Validates command line parameters and creates a local python test server if | 78 // Validates command line parameters and creates a local python test server if |
79 // specified. | 79 // specified. |
80 virtual void SetUp(); | 80 virtual void SetUp() OVERRIDE; |
81 | 81 |
82 // Brings down local python test server if one was created. | 82 // Brings down local python test server if one was created. |
83 virtual void TearDown(); | 83 virtual void TearDown() OVERRIDE; |
84 | 84 |
85 // Sets up command line flags required for sync tests. | 85 // Sets up command line flags required for sync tests. |
86 virtual void SetUpCommandLine(CommandLine* cl); | 86 virtual void SetUpCommandLine(CommandLine* cl) OVERRIDE; |
87 | 87 |
88 // Used to get the number of sync clients used by a test. | 88 // Used to get the number of sync clients used by a test. |
89 int num_clients() WARN_UNUSED_RESULT { return num_clients_; } | 89 int num_clients() WARN_UNUSED_RESULT { return num_clients_; } |
90 | 90 |
91 // Returns a pointer to a particular sync profile. Callee owns the object | 91 // Returns a pointer to a particular sync profile. Callee owns the object |
92 // and manages its lifetime. | 92 // and manages its lifetime. |
93 Profile* GetProfile(int index) WARN_UNUSED_RESULT; | 93 Profile* GetProfile(int index) WARN_UNUSED_RESULT; |
94 | 94 |
95 // Returns a pointer to a particular sync client. Callee owns the object | 95 // Returns a pointer to a particular sync client. Callee owns the object |
96 // and manages its lifetime. | 96 // and manages its lifetime. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 void TriggerMigrationDoneError(const syncable::ModelTypeSet& model_types); | 144 void TriggerMigrationDoneError(const syncable::ModelTypeSet& model_types); |
145 | 145 |
146 // Triggers the server to set its birthday to a random value thereby | 146 // Triggers the server to set its birthday to a random value thereby |
147 // the server would return a birthday error on next sync. | 147 // the server would return a birthday error on next sync. |
148 void TriggerBirthdayError(); | 148 void TriggerBirthdayError(); |
149 | 149 |
150 // Triggers a transient error on the server. Note the server will stay in | 150 // Triggers a transient error on the server. Note the server will stay in |
151 // this state until shut down. | 151 // this state until shut down. |
152 void TriggerTransientError(); | 152 void TriggerTransientError(); |
153 | 153 |
| 154 // Triggers setting the sync_tabs field of the nigori node. |
| 155 void TriggerSetSyncTabs(); |
| 156 |
154 protected: | 157 protected: |
| 158 // Add custom switches needed for running the test. |
| 159 virtual void AddTestSwitches(CommandLine* cl); |
| 160 |
| 161 // Append the command line switches to enable experimental types that aren't |
| 162 // on by default yet. |
| 163 virtual void AddOptionalTypesToCommandLine(CommandLine* cl); |
| 164 |
155 // InProcessBrowserTest override. Destroys all the sync clients and sync | 165 // InProcessBrowserTest override. Destroys all the sync clients and sync |
156 // profiles created by a test. | 166 // profiles created by a test. |
157 virtual void CleanUpOnMainThread(); | 167 virtual void CleanUpOnMainThread() OVERRIDE; |
158 | 168 |
159 // InProcessBrowserTest override. Changes behavior of the default host | 169 // InProcessBrowserTest override. Changes behavior of the default host |
160 // resolver to avoid DNS lookup errors. | 170 // resolver to avoid DNS lookup errors. |
161 virtual void SetUpInProcessBrowserTestFixture(); | 171 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; |
162 | 172 |
163 // InProcessBrowserTest override. Resets the host resolver its default | 173 // InProcessBrowserTest override. Resets the host resolver its default |
164 // behavior. | 174 // behavior. |
165 virtual void TearDownInProcessBrowserTestFixture(); | 175 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE; |
166 | 176 |
167 // GAIA account used by the test case. | 177 // GAIA account used by the test case. |
168 std::string username_; | 178 std::string username_; |
169 | 179 |
170 // GAIA password used by the test case. | 180 // GAIA password used by the test case. |
171 std::string password_; | 181 std::string password_; |
172 | 182 |
173 // Locally available plain text file in which GAIA credentials are stored. | 183 // Locally available plain text file in which GAIA credentials are stored. |
174 FilePath password_file_; | 184 FilePath password_file_; |
175 | 185 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // URLFetcher factory used to contact sync server. | 281 // URLFetcher factory used to contact sync server. |
272 scoped_ptr<URLFetcherFactory> integration_factory_; | 282 scoped_ptr<URLFetcherFactory> integration_factory_; |
273 | 283 |
274 // Whether or not to use notifications for the current test. | 284 // Whether or not to use notifications for the current test. |
275 bool enable_notifications_; | 285 bool enable_notifications_; |
276 | 286 |
277 DISALLOW_COPY_AND_ASSIGN(LiveSyncTest); | 287 DISALLOW_COPY_AND_ASSIGN(LiveSyncTest); |
278 }; | 288 }; |
279 | 289 |
280 #endif // CHROME_TEST_LIVE_SYNC_LIVE_SYNC_TEST_H_ | 290 #endif // CHROME_TEST_LIVE_SYNC_LIVE_SYNC_TEST_H_ |
OLD | NEW |