chromium/chrome/browser/sync/test/integration/saved_tab_groups_helper.h

// 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.

#ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_SAVED_TAB_GROUPS_HELPER_H_
#define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SAVED_TAB_GROUPS_HELPER_H_

#include <vector>

#include "base/memory/raw_ptr.h"
#include "base/uuid.h"
#include "chrome/browser/sync/test/integration/fake_server_match_status_checker.h"
#include "chrome/browser/sync/test/integration/status_change_checker.h"
#include "components/saved_tab_groups/saved_tab_group.h"
#include "components/saved_tab_groups/saved_tab_group_model_observer.h"
#include "components/saved_tab_groups/saved_tab_group_tab.h"
#include "components/sync/base/data_type.h"
#include "testing/gmock/include/gmock/gmock.h"

namespace sync_pb {
class SavedTabGroupSpecifics;
}  // namespace sync_pb

namespace tab_groups {
class SavedTabGroupModel;

MATCHER_P2(HasSpecificsSavedTabGroup, title, color, "") {}

MATCHER_P2(HasSpecificsSavedTab, title, url, "") {}

// Checks that a tab or group with a particular uuid exists in the model.
class SavedTabOrGroupExistsChecker : public StatusChangeChecker,
                                     public SavedTabGroupModelObserver {};

// Checks that a tab or group with a particular uuid does not exist in the
// model.
class SavedTabOrGroupDoesNotExistChecker : public StatusChangeChecker,
                                           public SavedTabGroupModelObserver {};

// Checks that a matching group exists in the model.
class SavedTabGroupMatchesChecker : public StatusChangeChecker,
                                    public SavedTabGroupModelObserver {};

// Checks that a matching tab exists in the model.
class SavedTabMatchesChecker : public StatusChangeChecker,
                               public SavedTabGroupModelObserver {};

// Checks that the model contains saved groups in a certain order.
class GroupOrderChecker : public StatusChangeChecker,
                          public SavedTabGroupModelObserver {};

// Checks that a saved group in the model contains tabs in a certain order.
class TabOrderChecker : public StatusChangeChecker,
                        public SavedTabGroupModelObserver {};

// A helper class that waits for the SAVED_TAB_GROUP entities on the FakeServer
// to match a given GMock matcher.
class ServerSavedTabGroupMatchChecker
    : public fake_server::FakeServerMatchStatusChecker {};

}  // namespace tab_groups

#endif  // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SAVED_TAB_GROUPS_HELPER_H_