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 <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.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 "net/dns/mock_host_resolver.h" | 18 #include "net/dns/mock_host_resolver.h" |
19 #include "net/http/http_status_code.h" | 19 #include "net/http/http_status_code.h" |
20 #include "net/url_request/url_request_status.h" | 20 #include "net/url_request/url_request_status.h" |
21 #include "sync/internal_api/public/base/model_type.h" | 21 #include "sync/internal_api/public/base/model_type.h" |
22 #include "sync/protocol/sync_protocol_error.h" | 22 #include "sync/protocol/sync_protocol_error.h" |
23 #include "sync/test/fake_server/fake_server.h" | 23 #include "sync/test/fake_server/fake_server.h" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 // GAIA account used by the test case. | 277 // GAIA account used by the test case. |
278 std::string username_; | 278 std::string username_; |
279 | 279 |
280 // GAIA password used by the test case. | 280 // GAIA password used by the test case. |
281 std::string password_; | 281 std::string password_; |
282 | 282 |
283 // Locally available plain text file in which GAIA credentials are stored. | 283 // Locally available plain text file in which GAIA credentials are stored. |
284 base::FilePath password_file_; | 284 base::FilePath password_file_; |
285 | 285 |
286 // The FakeServer used in tests with server type IN_PROCESS_FAKE_SERVER. | 286 // The FakeServer used in tests with server type IN_PROCESS_FAKE_SERVER. |
287 scoped_ptr<fake_server::FakeServer> fake_server_; | 287 std::unique_ptr<fake_server::FakeServer> fake_server_; |
288 | 288 |
289 private: | 289 private: |
290 // Handles Profile creation for given index. Profile's path and type is | 290 // Handles Profile creation for given index. Profile's path and type is |
291 // determined at runtime based on server type. | 291 // determined at runtime based on server type. |
292 void CreateProfile(int index); | 292 void CreateProfile(int index); |
293 | 293 |
294 // Callback for MakeProfileForUISignin() method. It runs the quit_closure once | 294 // Callback for MakeProfileForUISignin() method. It runs the quit_closure once |
295 // profile is created successfully. | 295 // profile is created successfully. |
296 static void CreateProfileCallback(const base::Closure& quit_closure, | 296 static void CreateProfileCallback(const base::Closure& quit_closure, |
297 Profile* profile, | 297 Profile* profile, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 void InitializeProfile(int index, Profile* profile); | 365 void InitializeProfile(int index, Profile* profile); |
366 | 366 |
367 // Sets up the client-side invalidations infrastructure depending on the | 367 // Sets up the client-side invalidations infrastructure depending on the |
368 // value of |server_type_|. | 368 // value of |server_type_|. |
369 void InitializeInvalidations(int index); | 369 void InitializeInvalidations(int index); |
370 | 370 |
371 // Python sync test server, started on demand. | 371 // Python sync test server, started on demand. |
372 syncer::LocalSyncTestServer sync_server_; | 372 syncer::LocalSyncTestServer sync_server_; |
373 | 373 |
374 // Helper class to whitelist the notification port. | 374 // Helper class to whitelist the notification port. |
375 scoped_ptr<net::ScopedPortException> xmpp_port_; | 375 std::unique_ptr<net::ScopedPortException> xmpp_port_; |
376 | 376 |
377 // Used to differentiate between single-client and two-client tests as well | 377 // Used to differentiate between single-client and two-client tests as well |
378 // as wher the in-process FakeServer is used. | 378 // as wher the in-process FakeServer is used. |
379 TestType test_type_; | 379 TestType test_type_; |
380 | 380 |
381 // Tells us what kind of server we're using (some tests run only on certain | 381 // Tells us what kind of server we're using (some tests run only on certain |
382 // server types). | 382 // server types). |
383 ServerType server_type_; | 383 ServerType server_type_; |
384 | 384 |
385 // Number of sync clients that will be created by a test. | 385 // Number of sync clients that will be created by a test. |
386 int num_clients_; | 386 int num_clients_; |
387 | 387 |
388 // Collection of sync profiles used by a test. A sync profile maintains sync | 388 // Collection of sync profiles used by a test. A sync profile maintains sync |
389 // data contained within its own subdirectory under the chrome user data | 389 // data contained within its own subdirectory under the chrome user data |
390 // directory. Profiles are owned by the ProfileManager. | 390 // directory. Profiles are owned by the ProfileManager. |
391 std::vector<Profile*> profiles_; | 391 std::vector<Profile*> profiles_; |
392 | 392 |
393 // Collection of profile delegates. Only used for test profiles, which require | 393 // Collection of profile delegates. Only used for test profiles, which require |
394 // a custom profile delegate to ensure initialization happens at the right | 394 // a custom profile delegate to ensure initialization happens at the right |
395 // time. | 395 // time. |
396 std::vector<scoped_ptr<Profile::Delegate>> profile_delegates_; | 396 std::vector<std::unique_ptr<Profile::Delegate>> profile_delegates_; |
397 | 397 |
398 // Collection of profile paths used by a test. Each profile has a unique path | 398 // Collection of profile paths used by a test. Each profile has a unique path |
399 // which should be cleaned up at test shutdown. Profile paths inside the | 399 // which should be cleaned up at test shutdown. Profile paths inside the |
400 // default user data dir gets deleted at InProcessBrowserTest teardown. | 400 // default user data dir gets deleted at InProcessBrowserTest teardown. |
401 std::vector<base::ScopedTempDir*> tmp_profile_paths_; | 401 std::vector<base::ScopedTempDir*> tmp_profile_paths_; |
402 | 402 |
403 // Collection of pointers to the browser objects used by a test. One browser | 403 // Collection of pointers to the browser objects used by a test. One browser |
404 // instance is created for each sync profile. Browser object lifetime is | 404 // instance is created for each sync profile. Browser object lifetime is |
405 // managed by BrowserList, so we don't use a ScopedVector here. | 405 // managed by BrowserList, so we don't use a ScopedVector here. |
406 std::vector<Browser*> browsers_; | 406 std::vector<Browser*> browsers_; |
(...skipping 29 matching lines...) Expand all Loading... |
436 bool notifications_enabled_; | 436 bool notifications_enabled_; |
437 | 437 |
438 // Indicates the need to create Gaia user account at runtime. This can only be | 438 // Indicates the need to create Gaia user account at runtime. This can only be |
439 // set if tests are run against external servers with support for user | 439 // set if tests are run against external servers with support for user |
440 // creation via http requests. | 440 // creation via http requests. |
441 bool create_gaia_account_at_runtime_; | 441 bool create_gaia_account_at_runtime_; |
442 | 442 |
443 // Sync integration tests need to make live DNS requests for access to | 443 // Sync integration tests need to make live DNS requests for access to |
444 // GAIA and sync server URLs under google.com. We use a scoped version | 444 // GAIA and sync server URLs under google.com. We use a scoped version |
445 // to override the default resolver while the test is active. | 445 // to override the default resolver while the test is active. |
446 scoped_ptr<net::ScopedDefaultHostResolverProc> mock_host_resolver_override_; | 446 std::unique_ptr<net::ScopedDefaultHostResolverProc> |
| 447 mock_host_resolver_override_; |
447 | 448 |
448 // Used to start and stop the local test server. | 449 // Used to start and stop the local test server. |
449 base::Process test_server_; | 450 base::Process test_server_; |
450 | 451 |
451 // Fake URLFetcher factory used to mock out GAIA signin. | 452 // Fake URLFetcher factory used to mock out GAIA signin. |
452 scoped_ptr<net::FakeURLFetcherFactory> fake_factory_; | 453 std::unique_ptr<net::FakeURLFetcherFactory> fake_factory_; |
453 | 454 |
454 // The URLFetcherImplFactory instance used to instantiate |fake_factory_|. | 455 // The URLFetcherImplFactory instance used to instantiate |fake_factory_|. |
455 scoped_ptr<net::URLFetcherImplFactory> factory_; | 456 std::unique_ptr<net::URLFetcherImplFactory> factory_; |
456 | 457 |
457 // The contents to be written to a profile's Preferences file before the | 458 // The contents to be written to a profile's Preferences file before the |
458 // Profile object is created. If empty, no preexisting file will be written. | 459 // Profile object is created. If empty, no preexisting file will be written. |
459 std::string preexisting_preferences_file_contents_; | 460 std::string preexisting_preferences_file_contents_; |
460 | 461 |
461 DISALLOW_COPY_AND_ASSIGN(SyncTest); | 462 DISALLOW_COPY_AND_ASSIGN(SyncTest); |
462 }; | 463 }; |
463 | 464 |
464 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ | 465 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ |
OLD | NEW |