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

#ifndef CHROME_BROWSER_UI_TABS_TEST_TAB_STRIP_MODEL_DELEGATE_H_
#define CHROME_BROWSER_UI_TABS_TEST_TAB_STRIP_MODEL_DELEGATE_H_

#include <optional>
#include <vector>

#include "base/memory/raw_ptr.h"
#include "chrome/browser/glic/host/glic.mojom.h"
#include "chrome/browser/glic/public/glic_keyed_service_factory.h"
#include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
#include "components/tab_groups/tab_group_id.h"

class BrowserWindowInterface;

namespace content {
class WebContents;
}  // namespace content

namespace split_tabs {
enum class SplitTabCreatedSource;
}

// Mock TabStripModelDelegate.
class TestTabStripModelDelegate : public TabStripModelDelegate {
 public:
  TestTabStripModelDelegate();
  TestTabStripModelDelegate(const TestTabStripModelDelegate&) = delete;
  TestTabStripModelDelegate& operator=(const TestTabStripModelDelegate&) =
      delete;
  ~TestTabStripModelDelegate() override;

  void SetBrowserWindowInterface(
      BrowserWindowInterface* browser_window_interface) {
    browser_window_interface_ = browser_window_interface;
  }

  // Overridden from TabStripModelDelegate:
  void AddTabAt(const GURL& url,
                int index,
                bool foregroud,
                std::optional<tab_groups::TabGroupId> group,
                bool pinned) override;
  BrowserWindowInterface* CreateNewStripWithTabs(
      std::vector<NewStripContents> tabs,
      const gfx::Rect& window_bounds,
      bool maximize) override;
  void WillAddWebContents(content::WebContents* contents) override;
  int GetDragActions() const override;
  bool CanDuplicateContentsAt(int index) override;
  bool IsTabStripEditable() override;
  content::WebContents* DuplicateContentsAt(int index) override;
  void DuplicateSplit(split_tabs::SplitTabId split) override;
  void MoveToExistingWindow(const std::vector<int>& indices,
                            int browser_index) override;
  bool CanMoveTabsToWindow(const std::vector<int>& indices) override;
  void MoveTabsToNewWindow(const std::vector<int>& indices) override;
  void MoveGroupToNewWindow(const tab_groups::TabGroupId& group) override;
  std::optional<SessionID> CreateHistoricalTab(
      content::WebContents* contents) override;
  void CreateHistoricalGroup(const tab_groups::TabGroupId& group) override;
  void CreateHistoricalSplit(const split_tabs::SplitTabId& split_id) override;
  void GroupAdded(const tab_groups::TabGroupId& group) override;
  void WillCloseGroup(const tab_groups::TabGroupId& group) override;
  void WillCloseSplit(const split_tabs::SplitTabId& split_id) override;
  void SplitClosed(const split_tabs::SplitTabId& split_id) override;
  void SplitCloseStopped(const split_tabs::SplitTabId& split_id) override;
  void GroupCloseStopped(const tab_groups::TabGroupId& group) override;
  bool ShouldRunUnloadListenerBeforeClosing(
      content::WebContents* contents) override;
  bool RunUnloadListenerBeforeClosing(content::WebContents* contents) override;
  bool CanReload() const override;
  void AddToReadLater(std::vector<content::WebContents*> web_contents) override;
  bool SupportsReadLater() override;
  bool IsForWebApp() override;
  void CopyURL(content::WebContents* web_contents) override;
  void GoBack(content::WebContents* web_contents) override;
  bool CanGoBack(content::WebContents* web_contents) override;
  bool IsNormalWindow() override;
  BrowserWindowInterface* GetBrowserWindowInterface() override;
  void NewSplitTab(std::vector<int> indices,
                   split_tabs::SplitTabLayout layout,
                   split_tabs::SplitTabCreatedSource source) override;
  void OnGroupsDestruction(const std::vector<tab_groups::TabGroupId>& group_ids,
                           base::OnceCallback<void()> callback,
                           bool delete_groups) override;
  void OnRemovingAllTabsFromGroups(
      const std::vector<tab_groups::TabGroupId>& group_ids,
      base::OnceCallback<void()> callback) override;
  void GlicUnpinTabsFromAllConversations(
      base::span<const tabs::TabHandle> tab_handles) override;
  void CloseTab(const tabs::TabInterface* tab,
                CloseTabSource source,
                base::OnceCallback<void(CloseTabSource)> on_approved) override;

 private:
  raw_ptr<BrowserWindowInterface> browser_window_interface_;
};

#endif  // CHROME_BROWSER_UI_TABS_TEST_TAB_STRIP_MODEL_DELEGATE_H_
