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

Unified Diff: chrome/browser/sync/test/integration/sync_test.cc

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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/test/integration/sync_test.cc
diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc
index 64cc0210c74bf66ebdc6ef7fc0dea9b4d2217b45..dacc4d7773c8c37fd6212a9e0a7c3da4053d4b5b 100644
--- a/chrome/browser/sync/test/integration/sync_test.cc
+++ b/chrome/browser/sync/test/integration/sync_test.cc
@@ -698,8 +698,15 @@ bool SyncTest::SetupAndClearClient(size_t index) {
return true;
}
+void SyncTest::CloseBrowserWindowAtIndex(size_t index) {
+ size_t init_browser_count = chrome::GetTotalBrowserCount();
+ CloseBrowserSynchronously(browsers_[index]);
+ closed_browsers_indicies_.insert(index);
+ CHECK_EQ(chrome::GetTotalBrowserCount(), init_browser_count - 1);
+}
+
void SyncTest::TearDownOnMainThread() {
- for (size_t i = 0; i < clients_.size(); ++i) {
+ for (size_t i = 0; i < 1; ++i) {
clients_[i]->service()->RequestStop(ProfileSyncService::CLEAR_DATA);
}
@@ -708,10 +715,12 @@ void SyncTest::TearDownOnMainThread() {
// closed by the creator of that browser.
size_t init_browser_count = chrome::GetTotalBrowserCount();
for (size_t i = 0; i < browsers_.size(); ++i) {
- CloseBrowserSynchronously(browsers_[i]);
+ if (closed_browsers_indicies_.count(i) == 0)
+ CloseBrowserSynchronously(browsers_[i]);
}
- CHECK_EQ(chrome::GetTotalBrowserCount(),
- init_browser_count - browsers_.size());
+ CHECK_EQ(
+ chrome::GetTotalBrowserCount(),
+ init_browser_count - browsers_.size() + closed_browsers_indicies_.size());
if (fake_server_.get()) {
std::vector<fake_server::FakeServerInvalidationService*>::const_iterator it;
@@ -1188,3 +1197,21 @@ bool SyncTest::ClearServerData(ProfileSyncServiceHarness* harness) {
// the new birthday from the server.
return harness->RestartSyncService();
}
+
+void SyncTest::TearDownWithSpecificBrowserClose(int index) {
+ clients_[index]->service()->RequestStop(ProfileSyncService::CLEAR_DATA);
+ CloseBrowserSynchronously(browsers_[index]);
+
+ if (fake_server_.get()) {
+ std::vector<fake_server::FakeServerInvalidationService*>::const_iterator it;
+ for (it = fake_server_invalidation_services_.begin();
+ it != fake_server_invalidation_services_.end(); ++it) {
+ fake_server_->RemoveObserver(*it);
+ }
+ }
+
+ invalidation_forwarders_.clear();
+ sync_refreshers_.clear();
+ fake_server_invalidation_services_.clear();
+ clients_.clear();
+}

Powered by Google App Engine
This is Rietveld 408576698