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/fake_server/fake_server.h" |
22 #include "sync/test/local_sync_test_server.h" | 22 #include "sync/test/local_sync_test_server.h" |
23 | 23 |
24 | |
25 class CommandLine; | |
26 class Profile; | 24 class Profile; |
27 class ProfileSyncServiceHarness; | 25 class ProfileSyncServiceHarness; |
28 | 26 |
| 27 namespace base { |
| 28 class CommandLine; |
| 29 } |
| 30 |
29 namespace net { | 31 namespace net { |
30 class FakeURLFetcherFactory; | 32 class FakeURLFetcherFactory; |
31 class ProxyConfig; | 33 class ProxyConfig; |
32 class ScopedDefaultHostResolverProc; | 34 class ScopedDefaultHostResolverProc; |
33 class URLFetcherImplFactory; | 35 class URLFetcherImplFactory; |
34 class URLRequestContextGetter; | 36 class URLRequestContextGetter; |
35 } | 37 } |
36 | 38 |
37 // This is the base class for integration tests for all sync data types. Derived | 39 // This is the base class for integration tests for all sync data types. Derived |
38 // classes must be defined for each sync data type. Individual tests are defined | 40 // classes must be defined for each sync data type. Individual tests are defined |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 virtual ~SyncTest(); | 115 virtual ~SyncTest(); |
114 | 116 |
115 // Validates command line parameters and creates a local python test server if | 117 // Validates command line parameters and creates a local python test server if |
116 // specified. | 118 // specified. |
117 virtual void SetUp() OVERRIDE; | 119 virtual void SetUp() OVERRIDE; |
118 | 120 |
119 // Brings down local python test server if one was created. | 121 // Brings down local python test server if one was created. |
120 virtual void TearDown() OVERRIDE; | 122 virtual void TearDown() OVERRIDE; |
121 | 123 |
122 // Sets up command line flags required for sync tests. | 124 // Sets up command line flags required for sync tests. |
123 virtual void SetUpCommandLine(CommandLine* cl) OVERRIDE; | 125 virtual void SetUpCommandLine(base::CommandLine* cl) OVERRIDE; |
124 | 126 |
125 // Used to get the number of sync clients used by a test. | 127 // Used to get the number of sync clients used by a test. |
126 int num_clients() WARN_UNUSED_RESULT { return num_clients_; } | 128 int num_clients() WARN_UNUSED_RESULT { return num_clients_; } |
127 | 129 |
128 // Returns a pointer to a particular sync profile. Callee owns the object | 130 // Returns a pointer to a particular sync profile. Callee owns the object |
129 // and manages its lifetime. | 131 // and manages its lifetime. |
130 Profile* GetProfile(int index) WARN_UNUSED_RESULT; | 132 Profile* GetProfile(int index) WARN_UNUSED_RESULT; |
131 | 133 |
132 // Returns a pointer to a particular browser. Callee owns the object | 134 // Returns a pointer to a particular browser. Callee owns the object |
133 // and manages its lifetime. | 135 // and manages its lifetime. |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 // error: The error the server is expected to return. | 232 // error: The error the server is expected to return. |
231 // frequency: Frequency with which the error is returned. | 233 // frequency: Frequency with which the error is returned. |
232 void TriggerSyncError(const syncer::SyncProtocolError& error, | 234 void TriggerSyncError(const syncer::SyncProtocolError& error, |
233 SyncErrorFrequency frequency); | 235 SyncErrorFrequency frequency); |
234 | 236 |
235 // Triggers the creation the Synced Bookmarks folder on the server. | 237 // Triggers the creation the Synced Bookmarks folder on the server. |
236 void TriggerCreateSyncedBookmarks(); | 238 void TriggerCreateSyncedBookmarks(); |
237 | 239 |
238 protected: | 240 protected: |
239 // Add custom switches needed for running the test. | 241 // Add custom switches needed for running the test. |
240 virtual void AddTestSwitches(CommandLine* cl); | 242 virtual void AddTestSwitches(base::CommandLine* cl); |
241 | 243 |
242 // Append the command line switches to enable experimental types that aren't | 244 // Append the command line switches to enable experimental types that aren't |
243 // on by default yet. | 245 // on by default yet. |
244 virtual void AddOptionalTypesToCommandLine(CommandLine* cl); | 246 virtual void AddOptionalTypesToCommandLine(base::CommandLine* cl); |
245 | 247 |
246 // InProcessBrowserTest override. Destroys all the sync clients and sync | 248 // InProcessBrowserTest override. Destroys all the sync clients and sync |
247 // profiles created by a test. | 249 // profiles created by a test. |
248 virtual void CleanUpOnMainThread() OVERRIDE; | 250 virtual void CleanUpOnMainThread() OVERRIDE; |
249 | 251 |
250 // InProcessBrowserTest override. Changes behavior of the default host | 252 // InProcessBrowserTest override. Changes behavior of the default host |
251 // resolver to avoid DNS lookup errors. | 253 // resolver to avoid DNS lookup errors. |
252 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; | 254 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; |
253 | 255 |
254 // InProcessBrowserTest override. Resets the host resolver its default | 256 // InProcessBrowserTest override. Resets the host resolver its default |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 // Fake URLFetcher factory used to mock out GAIA signin. | 394 // Fake URLFetcher factory used to mock out GAIA signin. |
393 scoped_ptr<net::FakeURLFetcherFactory> fake_factory_; | 395 scoped_ptr<net::FakeURLFetcherFactory> fake_factory_; |
394 | 396 |
395 // The URLFetcherImplFactory instance used to instantiate |fake_factory_|. | 397 // The URLFetcherImplFactory instance used to instantiate |fake_factory_|. |
396 scoped_ptr<net::URLFetcherImplFactory> factory_; | 398 scoped_ptr<net::URLFetcherImplFactory> factory_; |
397 | 399 |
398 DISALLOW_COPY_AND_ASSIGN(SyncTest); | 400 DISALLOW_COPY_AND_ASSIGN(SyncTest); |
399 }; | 401 }; |
400 | 402 |
401 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ | 403 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ |
OLD | NEW |