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

Unified Diff: components/sync_sessions/sessions_sync_manager_unittest.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
« no previous file with comments | « components/sync_sessions/sessions_sync_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync_sessions/sessions_sync_manager_unittest.cc
diff --git a/components/sync_sessions/sessions_sync_manager_unittest.cc b/components/sync_sessions/sessions_sync_manager_unittest.cc
index ab5cbfde94db4bca324d1de09698e5347f57bed4..aa2de49d10cc62d1a369d0ddb66c179c4f3711c9 100644
--- a/components/sync_sessions/sessions_sync_manager_unittest.cc
+++ b/components/sync_sessions/sessions_sync_manager_unittest.cc
@@ -1760,6 +1760,30 @@ TEST_F(SessionsSyncManagerTest, OnLocalTabModified) {
EXPECT_EQ(1, window->GetTabAt(1)->GetSyncId());
}
+TEST_F(SessionsSyncManagerTest, TabSyncChangesOnShutdown) {
+ SyncChangeList out;
+ // Init with no local data, relies on MergeLocalSessionNoTabs.
+ TestSyncedWindowDelegate* window = AddWindow();
+ SessionID::id_type window_id = window->GetSessionId();
+ InitWithSyncDataTakeOutput(syncer::SyncDataList(), &out);
+ EXPECT_FALSE(manager()->current_machine_tag().empty());
+ EXPECT_EQ(2U, out.size());
+
+ NavigateTab(AddTab(window_id, kFoo1), kFoo2);
+ NavigateTab(AddTab(window_id, kBar1), kBar2);
+ out.clear();
+
+ EXPECT_FALSE(manager()->GetAllBrowsersClosingForTesting());
+ manager()->SetAllBrowsersClosing(true);
+ browser()->tab_strip_model()->CloseWebContentsAt(1,
+ TabStripModel::CLOSE_NONE);
+ EXPECT_EQ(0U, out.size());
+
+ manager()->SetAllBrowsersClosing(false);
+ browser()->tab_strip_model()->CloseAllTabs();
+ EXPECT_EQ(1U, out.size());
+}
+
TEST_F(SessionsSyncManagerTest, ForeignSessionModifiedTime) {
SyncDataList foreign_data;
base::Time newest_time = base::Time::Now() - base::TimeDelta::FromDays(1);
« no previous file with comments | « components/sync_sessions/sessions_sync_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698