chromium/chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_keyed_service_unittest.cc

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

#include "chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_keyed_service.h"

#include <memory>

#include "base/test/scoped_feature_list.h"
#include "chrome/browser/tab_group_sync/tab_group_sync_tab_state.h"
#include "chrome/browser/tab_group_sync/tab_group_sync_utils.h"
#include "chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_model_listener.h"
#include "chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_service_factory.h"
#include "chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_utils.h"
#include "chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_web_contents_listener.h"
#include "chrome/browser/ui/tabs/tab_group.h"
#include "chrome/browser/ui/tabs/tab_group_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/browser_with_test_window_test.h"
#include "chrome/test/base/testing_profile.h"
#include "components/saved_tab_groups/features.h"
#include "components/saved_tab_groups/types.h"
#include "components/saved_tab_groups/utils.h"
#include "components/sync_device_info/fake_device_info_tracker.h"
#include "components/tab_groups/tab_group_color.h"
#include "components/tab_groups/tab_group_id.h"
#include "components/tab_groups/tab_group_visual_data.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/web_contents_tester.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/page_transition_types.h"
#include "ui/base/ui_base_types.h"

namespace tab_groups {

class SavedTabGroupKeyedServiceUnitTest : public BrowserWithTestWindowTest {};

TEST_F(SavedTabGroupKeyedServiceUnitTest, GetBrowserWithTabGroupId) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest,
       UngroupingStopsListeningToWebContents) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest, AddedTabIsListenedTo) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest, PauseResumeTracking) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest, ResumeTrackingValidatesConsistency) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest, AlreadyOpenedGroupIsFocused) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest,
       ActiveTabInAlreadyOpenedGroupIsFocused) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest,
       RestoredGroupWithoutSavedGuidIsDiscarded) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest,
       KeyedServiceLinksTabIdsToGuidsWhenModelIsLoaded) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest,
       KeyedServiceUpdatesOpenTabGroupOnSyncUpdates) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest,
       KeyedServiceUpdatesRestoredGroupWithOneLessTabToMatchSavedGroup) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest,
       KeyedServiceUpdatesRestoredGroupWithExtraTabToMatchSavedGroup) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest, NewTabFromSyncOpensInLocalGroup) {}

// Verifies that changes from sync will navigate the corresponding tab unless it
// was a fragment change happening on the same domain (Ex:
// https://www.example.com and https:://www.example.com#this_is_a_fragment).
TEST_F(SavedTabGroupKeyedServiceUnitTest,
       NavigateTabFromSyncNavigatesLocalTab) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest, SimulateLocalThenSyncTabNavigations) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest, SimulateSyncThenLocalTabNavigations) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest, RemoveTabFromSyncRemovesLocalTab) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest,
       RemoveLastTabFromSyncRemovesLocalTabAndLocalGroup) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest,
       RemoveGroupFromSyncRemovesLocalTabAndLocalGroup) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest,
       ReorderTabLocallyUpdatesSavedTabGroupTabOrder) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest, ReorderTabFromSyncReordersLocalTab) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest,
       DiscardingATabDoesntCrashWhenReordering) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest,
       NewBadTabFromSyncOpensInLocalGroupOnNewTabPage) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest,
       NavigateTabFromSyncWithBadURLDoesntNavigateLocalTab) {}

// Local
// Creation of Bad tab is NTP
// Navigation of Bad tab doesnt update

TEST_F(SavedTabGroupKeyedServiceUnitTest, AddedBadTabIsNTPInstead) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest,
       TabLocalNavigationToBadURLDoesntUpdateModel) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest,
       RedirectAfterDeleteRequestDoesntUpdateModel) {}

// Save group in front of others when `is_pinned` is true.
TEST_F(SavedTabGroupKeyedServiceUnitTest, SaveGroupIsPinned) {}

// Tests TabGroupsSaveV2 specific interactions. In this mode, all tab groups are
// saved by default (the only exception is incognito and guest mode).
class SavedTabGroupKeyedServiceUnitTestV2 : public BrowserWithTestWindowTest {};

TEST_F(SavedTabGroupKeyedServiceUnitTestV2, LastTabRemoveFromSyncClosesGroup) {}

TEST_F(SavedTabGroupKeyedServiceUnitTestV2,
       GroupRemovedFromSyncClosesOpenGroup) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest, CreateTabStateOnSyncNavigations) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest, TabStateClearedOnUserInput) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest,
       TabStateNotClearedOnForwardBackwardNavigations) {}

TEST_F(SavedTabGroupKeyedServiceUnitTest, TabStateNotClearedOnReload) {}

}  // namespace tab_groups