Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: chrome/browser/sync/test/integration/sync_test.h

Issue 2835503003: Replace SyncTest::SetUpInProcessBrowserTestFixture with SyncTest::SetUpOnMainThread. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/sync/test/integration/sync_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/process/process.h" 14 #include "base/process/process.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/test/base/in_process_browser_test.h" 16 #include "chrome/test/base/in_process_browser_test.h"
17 #include "components/sync/base/model_type.h" 17 #include "components/sync/base/model_type.h"
18 #include "components/sync/protocol/sync_protocol_error.h" 18 #include "components/sync/protocol/sync_protocol_error.h"
19 #include "components/sync/test/fake_server/fake_server.h" 19 #include "components/sync/test/fake_server/fake_server.h"
20 #include "components/sync/test/local_sync_test_server.h" 20 #include "components/sync/test/local_sync_test_server.h"
21 #include "net/dns/mock_host_resolver.h"
22 #include "net/http/http_status_code.h" 21 #include "net/http/http_status_code.h"
23 #include "net/url_request/url_request_status.h" 22 #include "net/url_request/url_request_status.h"
24 23
25 // The E2E tests are designed to run against real backend servers. To identify 24 // The E2E tests are designed to run against real backend servers. To identify
26 // those tests we use *E2ETest* test name filter and run disabled tests. 25 // those tests we use *E2ETest* test name filter and run disabled tests.
27 // 26 //
28 // The following macros define how a test is run: 27 // The following macros define how a test is run:
29 // - E2E_ONLY: Marks a test to run only as an E2E test against backend servers. 28 // - E2E_ONLY: Marks a test to run only as an E2E test against backend servers.
30 // These tests DO NOT run on regular Chromium waterfalls. 29 // These tests DO NOT run on regular Chromium waterfalls.
31 // - E2E_ENABLED: Marks a test to run as an E2E test in addition to Chromium 30 // - E2E_ENABLED: Marks a test to run as an E2E test in addition to Chromium
(...skipping 23 matching lines...) Expand all
55 class ProfileSyncService; 54 class ProfileSyncService;
56 } // namespace browser_sync 55 } // namespace browser_sync
57 56
58 namespace fake_server { 57 namespace fake_server {
59 class FakeServer; 58 class FakeServer;
60 class FakeServerInvalidationService; 59 class FakeServerInvalidationService;
61 } // namespace fake_server 60 } // namespace fake_server
62 61
63 namespace net { 62 namespace net {
64 class FakeURLFetcherFactory; 63 class FakeURLFetcherFactory;
65 class ScopedDefaultHostResolverProc;
66 class URLFetcherImplFactory; 64 class URLFetcherImplFactory;
67 } // namespace net 65 } // namespace net
68 66
69 // This is the base class for integration tests for all sync data types. Derived 67 // This is the base class for integration tests for all sync data types. Derived
70 // classes must be defined for each sync data type. Individual tests are defined 68 // classes must be defined for each sync data type. Individual tests are defined
71 // using the IN_PROC_BROWSER_TEST_F macro. 69 // using the IN_PROC_BROWSER_TEST_F macro.
72 class SyncTest : public InProcessBrowserTest { 70 class SyncTest : public InProcessBrowserTest {
73 public: 71 public:
74 // The different types of live sync tests that can be implemented. 72 // The different types of live sync tests that can be implemented.
75 enum TestType { 73 enum TestType {
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 arc::SyncArcPackageHelper* sync_arc_helper(); 255 arc::SyncArcPackageHelper* sync_arc_helper();
258 256
259 protected: 257 protected:
260 // Add custom switches needed for running the test. 258 // Add custom switches needed for running the test.
261 virtual void AddTestSwitches(base::CommandLine* cl); 259 virtual void AddTestSwitches(base::CommandLine* cl);
262 260
263 // Append the command line switches to enable experimental types that aren't 261 // Append the command line switches to enable experimental types that aren't
264 // on by default yet. 262 // on by default yet.
265 virtual void AddOptionalTypesToCommandLine(base::CommandLine* cl); 263 virtual void AddOptionalTypesToCommandLine(base::CommandLine* cl);
266 264
267 // BrowserTestBase override. Destroys all the sync clients and sync 265 // BrowserTestBase implementation:
268 // profiles created by a test. 266 void SetUpOnMainThread() override;
269 void TearDownOnMainThread() override; 267 void TearDownOnMainThread() override;
270 268
271 // InProcessBrowserTest override. Changes behavior of the default host
272 // resolver to avoid DNS lookup errors.
273 void SetUpInProcessBrowserTestFixture() override;
274
275 // InProcessBrowserTest override. Resets the host resolver its default
276 // behavior.
277 void TearDownInProcessBrowserTestFixture() override;
278
279 // Implementations of the EnableNotifications() and DisableNotifications() 269 // Implementations of the EnableNotifications() and DisableNotifications()
280 // functions defined above. 270 // functions defined above.
281 void DisableNotificationsImpl(); 271 void DisableNotificationsImpl();
282 void EnableNotificationsImpl(); 272 void EnableNotificationsImpl();
283 273
284 // If non-empty, |contents| will be written to a profile's Preferences file 274 // If non-empty, |contents| will be written to a profile's Preferences file
285 // before the Profile object is created. 275 // before the Profile object is created.
286 void SetPreexistingPreferencesFileContents(const std::string& contents); 276 void SetPreexistingPreferencesFileContents(const std::string& contents);
287 277
288 // Helper to ProfileManager::CreateProfileAsync that creates a new profile 278 // Helper to ProfileManager::CreateProfileAsync that creates a new profile
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 439
450 // Indicates whether changes to a profile should also change the verifier 440 // Indicates whether changes to a profile should also change the verifier
451 // profile or not. 441 // profile or not.
452 bool use_verifier_; 442 bool use_verifier_;
453 443
454 // Indicates the need to create Gaia user account at runtime. This can only be 444 // Indicates the need to create Gaia user account at runtime. This can only be
455 // set if tests are run against external servers with support for user 445 // set if tests are run against external servers with support for user
456 // creation via http requests. 446 // creation via http requests.
457 bool create_gaia_account_at_runtime_; 447 bool create_gaia_account_at_runtime_;
458 448
459 // Sync integration tests need to make live DNS requests for access to
460 // GAIA and sync server URLs under google.com. We use a scoped version
461 // to override the default resolver while the test is active.
462 std::unique_ptr<net::ScopedDefaultHostResolverProc>
463 mock_host_resolver_override_;
464
465 // Used to start and stop the local test server. 449 // Used to start and stop the local test server.
466 base::Process test_server_; 450 base::Process test_server_;
467 451
468 // Fake URLFetcher factory used to mock out GAIA signin. 452 // Fake URLFetcher factory used to mock out GAIA signin.
469 std::unique_ptr<net::FakeURLFetcherFactory> fake_factory_; 453 std::unique_ptr<net::FakeURLFetcherFactory> fake_factory_;
470 454
471 // The URLFetcherImplFactory instance used to instantiate |fake_factory_|. 455 // The URLFetcherImplFactory instance used to instantiate |fake_factory_|.
472 std::unique_ptr<net::URLFetcherImplFactory> factory_; 456 std::unique_ptr<net::URLFetcherImplFactory> factory_;
473 457
474 // 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
475 // 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.
476 std::string preexisting_preferences_file_contents_; 460 std::string preexisting_preferences_file_contents_;
477 461
478 DISALLOW_COPY_AND_ASSIGN(SyncTest); 462 DISALLOW_COPY_AND_ASSIGN(SyncTest);
479 }; 463 };
480 464
481 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ 465 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/test/integration/sync_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698