chromium/chrome/browser/sync/test/integration/single_client_saved_tab_groups_sync_test.cc

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/ranges/algorithm.h"
#include "base/uuid.h"
#include "chrome/browser/sync/test/integration/saved_tab_groups_helper.h"
#include "chrome/browser/sync/test/integration/sync_service_impl_harness.h"
#include "chrome/browser/sync/test/integration/sync_test.h"
#include "chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_keyed_service.h"
#include "chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_service_factory.h"
#include "components/saved_tab_groups/features.h"
#include "components/saved_tab_groups/saved_tab_group.h"
#include "components/saved_tab_groups/saved_tab_group_model.h"
#include "components/saved_tab_groups/saved_tab_group_sync_bridge.h"
#include "components/saved_tab_groups/saved_tab_group_tab.h"
#include "components/sync/base/data_type.h"
#include "components/sync/base/features.h"
#include "components/sync/protocol/saved_tab_group_specifics.pb.h"
#include "components/sync/protocol/sync.pb.h"
#include "components/sync/protocol/sync_entity.pb.h"
#include "components/sync/test/fake_server.h"
#include "content/public/test/browser_test.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace tab_groups {
namespace {

sync_pb::SavedTabGroupSpecifics CreateSavedTabGroupSpecific(base::Uuid guid,
                                                            bool ui_v2,
                                                            int position) {}

class SingleClientSavedTabGroupsSyncTest
    : public SyncTest,
      public ::testing::WithParamInterface<bool> {};

// Save a group with two tabs and validate they are added to the model.
IN_PROC_BROWSER_TEST_P(SingleClientSavedTabGroupsSyncTest,
                       DownloadsGroupAndTabs) {}

// Save a group with no tabs and validate it is added to the model.
IN_PROC_BROWSER_TEST_P(SingleClientSavedTabGroupsSyncTest,
                       DownloadsGroupWithNoTabs) {}

// Save a tab with no group and validate it is added to the model.
IN_PROC_BROWSER_TEST_P(SingleClientSavedTabGroupsSyncTest,
                       DownloadsTabWithNoGroup) {}

// Add a tab to an existing group.
IN_PROC_BROWSER_TEST_P(SingleClientSavedTabGroupsSyncTest, AddToExistingGroup) {}

// Remove one tab from a group with two tabs.
IN_PROC_BROWSER_TEST_P(SingleClientSavedTabGroupsSyncTest, RemoveTabFromGroup) {}

// Remove a saved group from the model.
IN_PROC_BROWSER_TEST_P(SingleClientSavedTabGroupsSyncTest, RemoveGroup) {}

// Update the metadata of a saved group already in the model.
IN_PROC_BROWSER_TEST_P(SingleClientSavedTabGroupsSyncTest,
                       UpdateGroupMetadata) {}

// Update the URL and title of a saved tab already in the model.
IN_PROC_BROWSER_TEST_P(SingleClientSavedTabGroupsSyncTest, UpdatedTabData) {}

// Reorder groups already saved in the model.
IN_PROC_BROWSER_TEST_P(SingleClientSavedTabGroupsSyncTest, ReorderGroups) {}

// Reorder tabs in a group.
IN_PROC_BROWSER_TEST_P(SingleClientSavedTabGroupsSyncTest, ReorderTabs) {}

IN_PROC_BROWSER_TEST_P(SingleClientSavedTabGroupsSyncTest,
                       V1BrowserWithV2Proto) {}

IN_PROC_BROWSER_TEST_P(SingleClientSavedTabGroupsSyncTest,
                       V2BrowserWithV1Proto) {}

INSTANTIATE_TEST_SUITE_P();

// On ChromeOS, Sync-the-feature gets started automatically once a primary
// account is signed in and the transport mode is not a thing.
#if !BUILDFLAG(IS_CHROMEOS_ASH)

// Subclass that enables an additional feature, namely
// `syncer::kReplaceSyncPromosWithSignInPromos`.
class SingleClientSavedTabGroupsSyncTestWithTransportMode
    : public SingleClientSavedTabGroupsSyncTest {};

// Save a group with two tabs and validate they are added to the model for a
// user that signs in without turning sync-the-feature on. It also verifies that
// the downloaded data goes away upon signout.
IN_PROC_BROWSER_TEST_P(SingleClientSavedTabGroupsSyncTestWithTransportMode,
                       DownloadsGroupAndTabsInTransportMode) {}

INSTANTIATE_TEST_SUITE_P();

#endif  // !BUILDFLAG(IS_CHROMEOS_ASH)

}  // namespace
}  // namespace tab_groups