Revert "[STG] Filter out groups of size 0 and orphan/delete them after a period"

This reverts commit f20d40b291c0553edfd853cdf460c19767f23124.

Reason for revert: causing a crash inside STGBar::AddTabGroupButton.

Original change's description:
> [STG] Filter out groups of size 0 and orphan/delete them after a period
>
> This is done because groups of size 0 can exist, and should be handled
> correctly (i.e. dont show them in the UI and delete them after a period of time)
>
> Bug: 365614810
> Change-Id: Icdbe41af41264cf3bb8f20223c016881ea5feed8
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5846997
> Reviewed-by: Rushan Suleymanov <rushans@google.com>
> Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
> Reviewed-by: Darryl James <dljames@chromium.org>
> Commit-Queue: David Pennington <dpenning@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1354921}

Bug: 365614810
Change-Id: I258aa2cb1e87166481c2b2fdefd16820d14e0eaa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5865514
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Daniel Yip <danielyip@google.com>
Owners-Override: Daniel Yip <danielyip@google.com>
Cr-Commit-Position: refs/heads/main@{#1355905}
diff --git a/chrome/browser/sync/test/integration/single_client_saved_tab_groups_sync_test.cc b/chrome/browser/sync/test/integration/single_client_saved_tab_groups_sync_test.cc
index 3c8b377..22beaf3 100644
--- a/chrome/browser/sync/test/integration/single_client_saved_tab_groups_sync_test.cc
+++ b/chrome/browser/sync/test/integration/single_client_saved_tab_groups_sync_test.cc
@@ -32,10 +32,8 @@
                                                             int position) {
   sync_pb::SavedTabGroupSpecifics pb_specific;
   pb_specific.set_guid(guid.AsLowercaseString());
-  pb_specific.set_creation_time_windows_epoch_micros(
-      base::Time::Now().ToDeltaSinceWindowsEpoch().InMicroseconds());
-  pb_specific.set_update_time_windows_epoch_micros(
-      base::Time::Now().ToDeltaSinceWindowsEpoch().InMicroseconds());
+  pb_specific.set_creation_time_windows_epoch_micros(10);
+  pb_specific.set_update_time_windows_epoch_micros(10);
   sync_pb::SavedTabGroup* pb_group = pb_specific.mutable_group();
   pb_group->set_color(sync_pb::SavedTabGroup::SAVED_TAB_GROUP_COLOR_GREY);
   pb_group->set_title("Test");
diff --git a/chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_keyed_service.cc b/chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_keyed_service.cc
index d2b65cf1..071756e2 100644
--- a/chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_keyed_service.cc
+++ b/chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_keyed_service.cc
@@ -188,14 +188,13 @@
   if (model()->is_loaded()) {
     CHECK(!model()->Contains(group.saved_guid()))
         << "This group is somehow saved already when it shouldn't be.";
-    const std::optional<LocalTabGroupID> local_id = group.local_group_id();
+
+    const LocalTabGroupID local_id = group.local_group_id().value();
     const base::Uuid sync_id = group.saved_guid();
     model_->Add(std::move(group));
-    if (local_id.has_value()) {
-      ConnectLocalTabGroup(local_id.value(), sync_id);
-    }
+    ConnectLocalTabGroup(local_id, sync_id);
   } else {
-    restored_groups_to_save_on_load_.emplace_back(std::move(group));
+    restored_groups_to_save_on_load_.emplace_back(group);
   }
 }
 
diff --git a/chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_keyed_service.h b/chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_keyed_service.h
index 54c431e7..3380a4e 100644
--- a/chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_keyed_service.h
+++ b/chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_keyed_service.h
@@ -93,8 +93,6 @@
 
   // Saves a restored group. This can be called prior to the saved tab
   // group model is loaded. These groups are saved when the model is loaded.
-  // This method will also connect an opened tab group to the saved group if the
-  // local id is provided via `group`.
   void SaveRestoredGroup(SavedTabGroup group);
 
   void UpdateAttributions(
diff --git a/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_bar.cc b/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_bar.cc
index 2f876fe5..aec2c46b 100644
--- a/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_bar.cc
+++ b/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_bar.cc
@@ -477,7 +477,7 @@
 
 void SavedTabGroupBar::SavedTabGroupLocalIdChanged(
     const base::Uuid& saved_group_id) {
-  UpsertSavedTabGroupButton(saved_group_id);
+  SavedTabGroupUpdated(saved_group_id);
 
   MaybeShowClosePromo(saved_group_id);
 }
@@ -485,7 +485,7 @@
 void SavedTabGroupBar::SavedTabGroupUpdatedLocally(
     const base::Uuid& group_guid,
     const std::optional<base::Uuid>& tab_guid) {
-  UpsertSavedTabGroupButton(group_guid);
+  SavedTabGroupUpdated(group_guid);
 }
 
 void SavedTabGroupBar::SavedTabGroupReorderedLocally() {
@@ -499,11 +499,11 @@
 void SavedTabGroupBar::SavedTabGroupTabMovedLocally(
     const base::Uuid& group_guid,
     const base::Uuid& tab_guid) {
-  UpsertSavedTabGroupButton(group_guid);
+  SavedTabGroupUpdated(group_guid);
 }
 
 void SavedTabGroupBar::SavedTabGroupAddedFromSync(const base::Uuid& guid) {
-  UpsertSavedTabGroupButton(guid);
+  SavedTabGroupAdded(guid);
 }
 
 void SavedTabGroupBar::SavedTabGroupRemovedFromSync(
@@ -514,7 +514,7 @@
 void SavedTabGroupBar::SavedTabGroupUpdatedFromSync(
     const base::Uuid& group_guid,
     const std::optional<base::Uuid>& tab_guid) {
-  UpsertSavedTabGroupButton(group_guid);
+  SavedTabGroupUpdated(group_guid);
 }
 
 void SavedTabGroupBar::OnInitialized() {
@@ -531,13 +531,13 @@
 
 void SavedTabGroupBar::OnTabGroupUpdated(const SavedTabGroup& group,
                                          TriggerSource source) {
-  UpsertSavedTabGroupButton(group.saved_guid());
+  SavedTabGroupUpdated(group.saved_guid());
 }
 
 void SavedTabGroupBar::OnTabGroupLocalIdChanged(
     const base::Uuid& sync_id,
     const std::optional<LocalTabGroupID>& local_id) {
-  UpsertSavedTabGroupButton(sync_id);
+  SavedTabGroupUpdated(sync_id);
   MaybeShowClosePromo(sync_id);
 }
 
@@ -673,10 +673,11 @@
 }
 
 void SavedTabGroupBar::SavedTabGroupAdded(const base::Uuid& guid) {
-  if (v2_ui_enabled_) {
-    UpsertSavedTabGroupButton(guid);
+  std::optional<int> index = GetIndexOfGroup(guid);
+  if (!index.has_value()) {
     return;
   }
+  AddTabGroupButton(tab_group_service_->GetGroup(guid).value(), index.value());
 
   InvalidateLayout();
 }
@@ -687,7 +688,7 @@
   InvalidateLayout();
 }
 
-void SavedTabGroupBar::UpsertSavedTabGroupButton(const base::Uuid& guid) {
+void SavedTabGroupBar::SavedTabGroupUpdated(const base::Uuid& guid) {
   std::optional<int> index = GetIndexOfGroup(guid);
   if (!index.has_value()) {
     return;
@@ -698,24 +699,21 @@
   SavedTabGroupButton* button =
       views::AsViewClass<SavedTabGroupButton>(GetButton(group->saved_guid()));
 
-  bool currently_has_a_button = button != nullptr;
-  bool should_have_a_button =
-      group->is_pinned() && !group->saved_tabs().empty();
-
+  // In v2, update can trigger by pin/unpin. Add TabGroupButton for a pin tab
+  // group if not present. Remove TabGroupButton for an unpinned tab group if
+  // present.
   if (v2_ui_enabled_) {
-    if (currently_has_a_button && should_have_a_button) {
-      button->UpdateButtonData(*group);
-    } else if (!currently_has_a_button && should_have_a_button) {
+    if (!button && !group->is_pinned()) {
+      return;
+    } else if (!button && group->is_pinned()) {
       AddTabGroupButton(*group, 0);
-    } else if (currently_has_a_button && !should_have_a_button) {
+    } else if (button && !group->is_pinned()) {
       RemoveChildViewT(button);
-    }
-  } else {
-    if (button) {
-      button->UpdateButtonData(*group);
     } else {
-      AddTabGroupButton(group.value(), index.value());
+      button->UpdateButtonData(*group);
     }
+  } else if (button) {
+    button->UpdateButtonData(*group);
   }
 
   InvalidateLayout();
diff --git a/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_bar.h b/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_bar.h
index 90e14623..5e47b79 100644
--- a/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_bar.h
+++ b/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_bar.h
@@ -136,9 +136,9 @@
   // `SavedTabGroupBar`.
   void SavedTabGroupRemoved(const base::Uuid& guid);
 
-  // Updates (adds/updates/removes) the button denoted by `guid` when calling
-  // add/update methods.
-  void UpsertSavedTabGroupButton(const base::Uuid& guid);
+  // Updates the button (color, name, tab list) denoted by `guid` in the
+  // `SavedTabGroupBar` if the `guid` exists in `saved_tab_group_model_`.
+  void SavedTabGroupUpdated(const base::Uuid& guid);
 
   // Reorders all groups in the bookmarks to match the state of
   // `saved_tab_group_model_`.
diff --git a/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_bar_unittest.cc b/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_bar_unittest.cc
index e79db621..aa6b903 100644
--- a/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_bar_unittest.cc
+++ b/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_bar_unittest.cc
@@ -751,24 +751,6 @@
             data.GetString16Attribute(ax::mojom::StringAttribute::kName));
 }
 
-TEST_P(SavedTabGroupBarUnitTest, GroupWithNoTabsDoesntShow) {
-  if (!IsV2UIEnabled()) {
-    GTEST_SKIP() << "N/A for V1";
-  }
-
-  EXPECT_EQ(1u, saved_tab_group_bar()->children().size());
-
-  SavedTabGroup empty_pinned_group(u"Test Title",
-                                   tab_groups::TabGroupColorId::kBlue, {});
-  // position must be set or the update time will be overridden during model
-  // save.
-  empty_pinned_group.SetPosition(0);
-
-  service()->AddGroup(std::move(empty_pinned_group));
-
-  EXPECT_EQ(1u, saved_tab_group_bar()->children().size());
-}
-
 INSTANTIATE_TEST_SUITE_P(SavedTabGroupBar,
                          SavedTabGroupBarUnitTest,
                          testing::Bool());
diff --git a/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_everything_menu.cc b/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_everything_menu.cc
index 722bac2..a3974f931 100644
--- a/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_everything_menu.cc
+++ b/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_everything_menu.cc
@@ -68,18 +68,14 @@
 
 base::Uuid STGEverythingMenu::GetTabGroupIdFromCommandId(int command_id) {
   const int idx_in_sorted_tab_group = (command_id - kMinCommandId) / kGap;
-  return groups_for_display_.at(idx_in_sorted_tab_group);
+  return sorted_tab_groups_.at(idx_in_sorted_tab_group);
 }
 
-std::vector<base::Uuid> STGEverythingMenu::GetGroupsForDisplay(
+std::vector<base::Uuid> STGEverythingMenu::GetSortedTabGroupsByCreationTime(
     TabGroupSyncService* tab_group_service) {
   CHECK(tab_group_service);
   std::vector<base::Uuid> sorted_tab_groups;
   for (const SavedTabGroup& group : tab_group_service->GetAllGroups()) {
-    if (group.saved_tabs().empty()) {
-      continue;
-    }
-
     sorted_tab_groups.push_back(group.saved_guid());
   }
   auto compare_by_creation_time = [=](const base::Uuid& a,
@@ -119,12 +115,11 @@
     menu_model->AddSeparator(ui::NORMAL_SEPARATOR);
   }
 
-  groups_for_display_ = GetGroupsForDisplay(tab_group_service);
-
+  sorted_tab_groups_ = GetSortedTabGroupsByCreationTime(tab_group_service);
   const auto* const color_provider = browser_->window()->GetColorProvider();
-  for (size_t i = 0; i < groups_for_display_.size(); ++i) {
+  for (size_t i = 0; i < sorted_tab_groups_.size(); ++i) {
     const std::optional<SavedTabGroup> tab_group =
-        tab_group_service->GetGroup(groups_for_display_[i]);
+        tab_group_service->GetGroup(sorted_tab_groups_[i]);
     // In case any tab group gets deleted while creating the model.
     if (!tab_group) {
       continue;
diff --git a/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_everything_menu.h b/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_everything_menu.h
index 08325cf..9615b39 100644
--- a/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_everything_menu.h
+++ b/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_everything_menu.h
@@ -97,8 +97,8 @@
   std::unique_ptr<ui::SimpleMenuModel> CreateMenuModel();
 
   // Returns sorted saved tab groups with the most recently created as the
-  // first, filtering out empty groups.
-  std::vector<base::Uuid> GetGroupsForDisplay(
+  // first.
+  std::vector<base::Uuid> GetSortedTabGroupsByCreationTime(
       TabGroupSyncService* wrapper_service);
 
   // Because all the menu items (i.e. tab group items in the Everything menu -
@@ -130,7 +130,7 @@
   int GetAndIncrementLatestCommandId();
 
   // Saved tab groups with the most recently created as the first.
-  std::vector<base::Uuid> groups_for_display_;
+  std::vector<base::Uuid> sorted_tab_groups_;
 
   // Owned by the Everything button.
   raw_ptr<views::MenuButtonController> menu_button_controller_;
diff --git a/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_interactive_uitest.cc b/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_interactive_uitest.cc
index b76f927..ea5f9e3 100644
--- a/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_interactive_uitest.cc
+++ b/chrome/browser/ui/views/bookmarks/saved_tab_groups/saved_tab_group_interactive_uitest.cc
@@ -2,8 +2,6 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include <optional>
-
 #include "base/test/bind.h"
 #include "base/test/gtest_util.h"
 #include "base/test/scoped_feature_list.h"
@@ -187,23 +185,6 @@
     });
   }
 
-  StepBuilder CreateEmptySavedGroup() {
-    return Do([=, this]() {
-      TabGroupSyncService* service =
-          SavedTabGroupUtils::GetServiceForProfile(browser()->profile());
-      service->AddGroup({u"Test Test",
-                         tab_groups::TabGroupColorId::kBlue,
-                         {},
-                         /*position=*/std::nullopt,
-                         base::Uuid::GenerateRandomV4(),
-                         /*local_group_id=*/std::nullopt,
-                         /*creator_cache_guid=*/std::nullopt,
-                         /*last_updater_cache_guid=*/std::nullopt,
-                         /*created_before_syncing_tab_groups=*/false,
-                         /*creation_time_windows_epoch_micros=*/std::nullopt});
-    });
-  }
-
   StepBuilder UnsaveGroupViaModel(const tab_groups::TabGroupId local_group) {
     return Do([=, this]() {
       TabGroupSyncService* service =
@@ -1173,43 +1154,6 @@
       EnsureNotPresent(kSavedTabGroupOverflowMenuId));
 }
 
-IN_PROC_BROWSER_TEST_P(SavedTabGroupInteractiveTest,
-                       EverythingMenuDoesntDisplayEmptyGroups) {
-  // The everything menu is only enabled in V2.
-  if (!IsV2UIEnabled()) {
-    GTEST_SKIP() << "N/A for V1";
-  }
-
-  RunTestSequence(
-      // Create an empty group
-      FinishTabstripAnimations(), ShowBookmarksBar(), CreateEmptySavedGroup(),
-      // Open the everything menu and expect the group to not show up.
-      CheckEverythingButtonVisibility(IsV2UIEnabled()),
-      PressButton(kSavedTabGroupOverflowButtonElementId),
-      WaitForShow(STGEverythingMenu::kCreateNewTabGroup),
-      EnsureNotPresent(STGEverythingMenu::kTabGroup));
-}
-
-IN_PROC_BROWSER_TEST_P(SavedTabGroupInteractiveTest,
-                       AppMenuDoesntDisplayEmptyGroups) {
-  // The everything menu is only enabled in V2.
-  if (!IsV2UIEnabled()) {
-    GTEST_SKIP() << "N/A for V1";
-  }
-
-  RunTestSequence(
-      // Create an empty group
-      FinishTabstripAnimations(), ShowBookmarksBar(), CreateEmptySavedGroup(),
-      // Open the app menu tab group menu.
-      PressButton(kToolbarAppMenuButtonElementId),
-
-      WaitForShow(AppMenuModel::kTabGroupsMenuItem),
-      SelectMenuItem(AppMenuModel::kTabGroupsMenuItem),
-      WaitForShow(STGEverythingMenu::kCreateNewTabGroup),
-      // Expect the group to not be displayed.
-      EnsureNotPresent(STGEverythingMenu::kTabGroup));
-}
-
 INSTANTIATE_TEST_SUITE_P(SavedTabGroupBar,
                          SavedTabGroupInteractiveTest,
                          testing::Bool());
diff --git a/components/saved_tab_groups/saved_tab_group.h b/components/saved_tab_groups/saved_tab_group.h
index 44c23731..6cff348 100644
--- a/components/saved_tab_groups/saved_tab_group.h
+++ b/components/saved_tab_groups/saved_tab_group.h
@@ -30,7 +30,7 @@
       const std::u16string& title,
       const tab_groups::TabGroupColorId& color,
       const std::vector<SavedTabGroupTab>& urls,
-      std::optional<size_t> position = std::nullopt,
+      std::optional<size_t> position,
       std::optional<base::Uuid> saved_guid = std::nullopt,
       std::optional<LocalTabGroupID> local_group_id = std::nullopt,
       std::optional<std::string> creator_cache_guid = std::nullopt,
diff --git a/components/saved_tab_groups/saved_tab_group_sync_bridge.cc b/components/saved_tab_groups/saved_tab_group_sync_bridge.cc
index bb78317..a480bbf 100644
--- a/components/saved_tab_groups/saved_tab_group_sync_bridge.cc
+++ b/components/saved_tab_groups/saved_tab_group_sync_bridge.cc
@@ -49,9 +49,8 @@
 namespace tab_groups {
 namespace {
 
-// Time period for orphaned tabs/groups to live till. once this threshold is
-// passed, on the next merge, they will be deleted.
-constexpr base::TimeDelta kOrphanedObjectDiscardThreshold = base::Days(30);
+// Discard orphaned tabs after 30 days if the associated group cannot be found.
+constexpr base::TimeDelta kDiscardOrphanedTabsThreshold = base::Days(30);
 
 bool IsValidSpecifics(const sync_pb::SavedTabGroupSpecifics& specifics) {
   // A valid specifics should have at least a guid and be either a group or a
@@ -171,7 +170,6 @@
   }
 
   ResolveTabsMissingGroups(write_batch.get());
-  ResolveGroupsMissingTabs(write_batch.get());
 
   // Update sync with any locally stored data not currently stored in sync.
   for (const SavedTabGroup* group : model_wrapper_->GetTabGroups()) {
@@ -234,7 +232,6 @@
   }
 
   ResolveTabsMissingGroups(write_batch.get());
-  ResolveGroupsMissingTabs(write_batch.get());
 
   write_batch->TakeMetadataChangesFrom(std::move(metadata_change_list));
   store_->CommitWriteBatch(
@@ -733,7 +730,7 @@
 
       // Discard the tabs that do not have an associated group and have not been
       // updated within the discard threshold.
-      if (now - last_update_time >= kOrphanedObjectDiscardThreshold) {
+      if (now - last_update_time >= kDiscardOrphanedTabsThreshold) {
         RemoveEntitySpecific(base::Uuid::ParseLowercase(specifics.guid()),
                              write_batch);
         tab_iterator = tabs_missing_groups_.erase(tab_iterator);
@@ -750,28 +747,6 @@
   }
 }
 
-void SavedTabGroupSyncBridge::ResolveGroupsMissingTabs(
-    syncer::DataTypeStore::WriteBatch* write_batch) {
-  std::vector<base::Uuid> orphaned_groups_to_destroy;
-  for (const SavedTabGroup* group : model_wrapper_->GetTabGroups()) {
-    if (!group->saved_tabs().empty()) {
-      continue;
-    }
-
-    if ((base::Time::Now() - group->update_time_windows_epoch_micros()) <
-        kOrphanedObjectDiscardThreshold) {
-      continue;
-    }
-
-    orphaned_groups_to_destroy.push_back(group->saved_guid());
-  }
-
-  for (const base::Uuid& group_id : orphaned_groups_to_destroy) {
-    model_wrapper_->RemoveGroup(group_id);
-    write_batch->DeleteData(group_id.AsLowercaseString());
-  }
-}
-
 void SavedTabGroupSyncBridge::AddEntryToBatch(syncer::MutableDataBatch* batch,
                                               proto::SavedTabGroupData data) {
   std::unique_ptr<syncer::EntityData> entity_data =
diff --git a/components/saved_tab_groups/saved_tab_group_sync_bridge.h b/components/saved_tab_groups/saved_tab_group_sync_bridge.h
index e461360..48dfe410 100644
--- a/components/saved_tab_groups/saved_tab_group_sync_bridge.h
+++ b/components/saved_tab_groups/saved_tab_group_sync_bridge.h
@@ -148,12 +148,6 @@
   // Attempts to add the tabs found in `tabs_missing_groups_` to local storage.
   void ResolveTabsMissingGroups(syncer::DataTypeStore::WriteBatch* write_batch);
 
-  // Iterates through groups saved in the model, and decides whether the group
-  // is orphaned and needs to be destroyed. If it does, destroys the group.
-  // An orphaned group is described as a group that has no tabs, and the last
-  // update time has been long enough ago that its likely to never get a tab.
-  void ResolveGroupsMissingTabs(syncer::DataTypeStore::WriteBatch* write_batch);
-
   // Adds the entry into `batch`.
   void AddEntryToBatch(syncer::MutableDataBatch* batch,
                        proto::SavedTabGroupData specifics);
diff --git a/components/saved_tab_groups/saved_tab_group_sync_bridge_unittest.cc b/components/saved_tab_groups/saved_tab_group_sync_bridge_unittest.cc
index a593aca4..d6e3b0c 100644
--- a/components/saved_tab_groups/saved_tab_group_sync_bridge_unittest.cc
+++ b/components/saved_tab_groups/saved_tab_group_sync_bridge_unittest.cc
@@ -1491,37 +1491,4 @@
       pref_service_.GetBoolean(prefs::kSavedTabGroupSpecificsToDataMigration));
 }
 
-TEST_F(SavedTabGroupSyncBridgeTest, NewlyOrphanedGroupsDontGetDestroyed) {
-  SavedTabGroup group(u"Test Title", tab_groups::TabGroupColorId::kBlue, {});
-  // position must be set or the update time will be overriden during model
-  // save.
-  group.SetPosition(0);
-  group.SetUpdateTimeWindowsEpochMicros(base::Time::Now());
-
-  saved_tab_group_model_.Add(std::move(group));
-  EXPECT_EQ(1u, saved_tab_group_model_.saved_tab_groups().size());
-
-  bridge_->MergeFullSyncData(bridge_->CreateMetadataChangeList(), {});
-
-  EXPECT_EQ(1u, saved_tab_group_model_.saved_tab_groups().size());
-}
-
-TEST_F(SavedTabGroupSyncBridgeTest, OldOrphanedGroupsGetDestroyed) {
-  auto id = base::Uuid::GenerateRandomV4();
-  SavedTabGroup group(u"Test Title", tab_groups::TabGroupColorId::kBlue, {});
-  // position must be set or the update time will be overriden during model
-  // save.
-  group.SetPosition(0);
-
-  group.SetUpdateTimeWindowsEpochMicros(
-      (base::Time::Now() - kDiscardOrphanedTabsThreshold) - base::Days(1));
-
-  saved_tab_group_model_.Add(std::move(group));
-  EXPECT_EQ(1u, saved_tab_group_model_.saved_tab_groups().size());
-
-  bridge_->MergeFullSyncData(bridge_->CreateMetadataChangeList(), {});
-
-  EXPECT_EQ(0u, saved_tab_group_model_.saved_tab_groups().size());
-}
-
 }  // namespace tab_groups