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

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

Issue 2750163003: Prevent tabs sync during browser shutdown.
Patch Set: Created 3 years, 9 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
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>
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 // Triggers the creation the Synced Bookmarks folder on the server. 245 // Triggers the creation the Synced Bookmarks folder on the server.
246 void TriggerCreateSyncedBookmarks(); 246 void TriggerCreateSyncedBookmarks();
247 247
248 // Returns the FakeServer being used for the test or null if FakeServer is 248 // Returns the FakeServer being used for the test or null if FakeServer is
249 // not being used. 249 // not being used.
250 fake_server::FakeServer* GetFakeServer() const; 250 fake_server::FakeServer* GetFakeServer() const;
251 251
252 // Triggers a sync for the given |model_types| for the Profile at |index|. 252 // Triggers a sync for the given |model_types| for the Profile at |index|.
253 void TriggerSyncForModelTypes(int index, syncer::ModelTypeSet model_types); 253 void TriggerSyncForModelTypes(int index, syncer::ModelTypeSet model_types);
254 254
255 void TearDownWithSpecificBrowserClose(int index);
256
255 protected: 257 protected:
256 // Add custom switches needed for running the test. 258 // Add custom switches needed for running the test.
257 virtual void AddTestSwitches(base::CommandLine* cl); 259 virtual void AddTestSwitches(base::CommandLine* cl);
258 260
259 // 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
260 // on by default yet. 262 // on by default yet.
261 virtual void AddOptionalTypesToCommandLine(base::CommandLine* cl); 263 virtual void AddOptionalTypesToCommandLine(base::CommandLine* cl);
262 264
263 // BrowserTestBase override. Destroys all the sync clients and sync 265 // BrowserTestBase override. Destroys all the sync clients and sync
264 // profiles created by a test. 266 // profiles created by a test.
265 void TearDownOnMainThread() override; 267 void TearDownOnMainThread() override;
266 268
267 // InProcessBrowserTest override. Changes behavior of the default host 269 // InProcessBrowserTest override. Changes behavior of the default host
268 // resolver to avoid DNS lookup errors. 270 // resolver to avoid DNS lookup errors.
269 void SetUpInProcessBrowserTestFixture() override; 271 void SetUpInProcessBrowserTestFixture() override;
270 272
271 // InProcessBrowserTest override. Resets the host resolver its default 273 // InProcessBrowserTest override. Resets the host resolver its default
272 // behavior. 274 // behavior.
273 void TearDownInProcessBrowserTestFixture() override; 275 void TearDownInProcessBrowserTestFixture() override;
274 276
275 // Implementations of the EnableNotifications() and DisableNotifications() 277 // Implementations of the EnableNotifications() and DisableNotifications()
276 // functions defined above. 278 // functions defined above.
277 void DisableNotificationsImpl(); 279 void DisableNotificationsImpl();
278 void EnableNotificationsImpl(); 280 void EnableNotificationsImpl();
279 281
280 // If non-empty, |contents| will be written to a profile's Preferences file 282 // If non-empty, |contents| will be written to a profile's Preferences file
281 // before the Profile object is created. 283 // before the Profile object is created.
282 void SetPreexistingPreferencesFileContents(const std::string& contents); 284 void SetPreexistingPreferencesFileContents(const std::string& contents);
283 285
286 // Close browser window at index.
287 void CloseBrowserWindowAtIndex(size_t index);
288
284 // Helper to ProfileManager::CreateProfileAsync that creates a new profile 289 // Helper to ProfileManager::CreateProfileAsync that creates a new profile
285 // used for UI Signin. Blocks until profile is created. 290 // used for UI Signin. Blocks until profile is created.
286 static Profile* MakeProfileForUISignin(base::FilePath profile_path); 291 static Profile* MakeProfileForUISignin(base::FilePath profile_path);
287 292
288 // GAIA account used by the test case. 293 // GAIA account used by the test case.
289 std::string username_; 294 std::string username_;
290 295
291 // GAIA password used by the test case. 296 // GAIA password used by the test case.
292 std::string password_; 297 std::string password_;
293 298
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 // Fake URLFetcher factory used to mock out GAIA signin. 471 // Fake URLFetcher factory used to mock out GAIA signin.
467 std::unique_ptr<net::FakeURLFetcherFactory> fake_factory_; 472 std::unique_ptr<net::FakeURLFetcherFactory> fake_factory_;
468 473
469 // The URLFetcherImplFactory instance used to instantiate |fake_factory_|. 474 // The URLFetcherImplFactory instance used to instantiate |fake_factory_|.
470 std::unique_ptr<net::URLFetcherImplFactory> factory_; 475 std::unique_ptr<net::URLFetcherImplFactory> factory_;
471 476
472 // The contents to be written to a profile's Preferences file before the 477 // The contents to be written to a profile's Preferences file before the
473 // Profile object is created. If empty, no preexisting file will be written. 478 // Profile object is created. If empty, no preexisting file will be written.
474 std::string preexisting_preferences_file_contents_; 479 std::string preexisting_preferences_file_contents_;
475 480
481 // Indicies of closed browsers. Stored to eliminate possible re-close.
482 std::set<size_t> closed_browsers_indicies_;
483
476 DISALLOW_COPY_AND_ASSIGN(SyncTest); 484 DISALLOW_COPY_AND_ASSIGN(SyncTest);
477 }; 485 };
478 486
479 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_ 487 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SYNC_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698