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

// Copyright 2012 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/base64.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/test_timeouts.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
#include "chrome/browser/browser_features.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
#include "chrome/browser/favicon/large_icon_service_factory.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/sync/session_sync_service_factory.h"
#include "chrome/browser/sync/test/integration/history_helper.h"
#include "chrome/browser/sync/test/integration/session_hierarchy_match_checker.h"
#include "chrome/browser/sync/test/integration/sessions_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/sync/test/integration/updated_progress_marker_checker.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/common/webui_url_constants.h"
#include "components/favicon/core/favicon_service.h"
#include "components/favicon/core/large_icon_service_impl.h"
#include "components/favicon_base/favicon_types.h"
#include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/history_types.h"
#include "components/sessions/core/session_types.h"
#include "components/signin/public/identity_manager/account_info.h"
#include "components/signin/public/identity_manager/accounts_in_cookie_jar_info.h"
#include "components/signin/public/identity_manager/identity_test_utils.h"
#include "components/sync/base/time.h"
#include "components/sync/engine/cycle/entity_change_metric_recording.h"
#include "components/sync/protocol/entity_specifics.pb.h"
#include "components/sync/protocol/proto_value_conversions.h"
#include "components/sync/protocol/session_specifics.pb.h"
#include "components/sync/protocol/sync.pb.h"
#include "components/sync/protocol/sync_entity.pb.h"
#include "components/sync/test/sessions_hierarchy.h"
#include "components/sync_sessions/session_store.h"
#include "components/sync_sessions/session_sync_service.h"
#include "components/sync_sessions/session_sync_test_helper.h"
#include "content/public/test/browser_test.h"
#include "google_apis/gaia/gaia_auth_util.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace {

SessionsHierarchy;
GetUrlFromClient;
CheckInitialState;
CloseTab;
ExecJs;
GetLocalWindows;
GetSessionData;
MoveTab;
NavigateTab;
NavigateTabBack;
NavigateTabForward;
OpenTab;
OpenTabAtIndex;
ScopedWindowMap;
SyncedSessionVector;
WaitForTabsToLoad;
WindowsMatch;
SessionSyncTestHelper;
IsEmpty;
UnorderedElementsAre;

static const char* kBaseFragmentURL =;
static const char* kSpecifiedFragmentURL =;

std::unique_ptr<net::test_server::HttpResponse> FaviconServerRequestHandler(
    const net::test_server::HttpRequest& request) {}

class IsHistoryURLSyncedChecker : public SingleClientStatusChangeChecker {};

class IsIconURLSyncedChecker : public SingleClientStatusChangeChecker {};

// Checker to block until the history DB for |profile| does / does not have a
// favicon for |page_url| (depending on |should_be_available|).
class FaviconForPageUrlAvailableChecker : public StatusChangeChecker {};

class SingleClientSessionsSyncTest : public SyncTest {};

IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest,
                       RequireProxyTabsForUiDelegate) {}

IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, Sanity) {}

IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, NavigateInTab) {}

IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest,
                       SessionsWithoutHistorySync) {}

IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, NoSessions) {}

IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, NavigateThenCloseTab) {}

IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest,
                       NavigateThenCloseTabThenOpenTab) {}

IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, TimestampMatchesHistory) {}

IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, ResponseCodeIsPreserved) {}

IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, FragmentURLNavigation) {}

IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest,
                       NavigationChainForwardBack) {}

IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest,
                       NavigationChainAlteredDestructively) {}

IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, OpenNewTab) {}

IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, OpenNewWindow) {}

IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest,
                       GarbageCollectionOfForeignSessions) {}

IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest,
                       GarbageCollectionOfForeignOrphanTabWithoutHeader) {}

// Regression test for crbug.com/915133 that verifies the browser doesn't crash
// if the server sends corrupt data during initial merge.
IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, CorruptInitialForeignTab) {}

// Regression test for crbug.com/915133 that verifies the browser doesn't crash
// if the server sends corrupt data as incremental update.
IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, CorruptForeignTabUpdate) {}

IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, TabMovedToOtherWindow) {}

IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, CookieJarMismatch) {}

IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest,
                       ShouldNotifyLoadedIconUrl) {}

class SingleClientSessionsSyncTestWithFaviconTestServer
    : public SingleClientSessionsSyncTest {};

IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTestWithFaviconTestServer,
                       ShouldDeleteOnDemandIconsOnSessionsDisabled) {}

class SingleClientSessionsWithoutDestroyProfileSyncTest
    : public SingleClientSessionsSyncTest {};

IN_PROC_BROWSER_TEST_F(SingleClientSessionsWithoutDestroyProfileSyncTest,
                       ShouldDeleteLastClosedTab) {}

#if !BUILDFLAG(IS_CHROMEOS)
class SingleClientSessionsWithDestroyProfileSyncTest
    : public SingleClientSessionsSyncTest {};

IN_PROC_BROWSER_TEST_F(SingleClientSessionsWithDestroyProfileSyncTest,
                       ShouldNotDeleteLastClosedTab) {}
#endif  // !BUILDFLAG(IS_CHROMEOS)

}  // namespace