chromium/chrome/browser/ui/webui/tab_search/tab_search_page_handler_unittest.cc

// Copyright 2020 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/webui/tab_search/tab_search_page_handler.h"

#include <stdint.h>

#include <memory>
#include <string>
#include <utility>
#include <vector>

#include "base/memory/raw_ptr.h"
#include "base/test/bind.h"
#include "base/timer/mock_timer.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/sessions/chrome_tab_restore_service_client.h"
#include "chrome/browser/sessions/tab_restore_service_factory.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/tabs/tab_enums.h"
#include "chrome/browser/ui/tabs/tab_utils.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/webui/metrics_reporter/metrics_reporter.h"
#include "chrome/browser/ui/webui/metrics_reporter/mock_metrics_reporter.h"
#include "chrome/browser/ui/webui/tab_search/tab_search.mojom-forward.h"
#include "chrome/test/base/browser_with_test_window_test.h"
#include "chrome/test/base/test_browser_window.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "components/sessions/core/tab_restore_service_impl.h"
#include "components/sync_preferences/pref_service_syncable.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/test/test_web_ui.h"
#include "content/public/test/web_contents_tester.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "ui/gfx/color_utils.h"

_;
Truly;

namespace {

constexpr char kTabUrl1[] =;
constexpr char kTabUrl2[] =;
constexpr char kTabUrl3[] =;
constexpr char kTabUrl4[] =;
constexpr char kTabUrl5[] =;
constexpr char kTabUrl6[] =;

constexpr char kTabName1[] =;
constexpr char kTabName2[] =;
constexpr char kTabName3[] =;
constexpr char kTabName4[] =;
constexpr char kTabName5[] =;
constexpr char kTabName6[] =;

class MockPage : public tab_search::mojom::Page {};

void ExpectNewTab(const tab_search::mojom::Tab* tab,
                  const std::string url,
                  const std::string title,
                  int index) {}

void ExpectRecentlyClosedTab(const tab_search::mojom::RecentlyClosedTab* tab,
                             const std::string url,
                             const std::string title) {}

void ExpectProfileTabs(tab_search::mojom::ProfileData* profile_tabs) {}

class TestTabSearchPageHandler : public TabSearchPageHandler {};

class TabSearchPageHandlerTest : public BrowserWithTestWindowTest {};

TEST_F(TabSearchPageHandlerTest, GetTabs) {}

TEST_F(TabSearchPageHandlerTest, TabsAndGroups) {}

TEST_F(TabSearchPageHandlerTest, MediaTabsTest) {}

TEST_F(TabSearchPageHandlerTest, RecentlyClosedTabGroup) {}

TEST_F(TabSearchPageHandlerTest, RecentlyClosedWindowWithGroupTabs) {}

// Ensure that repeated tab model changes do not result in repeated calls to
// TabsChanged() and TabsChanged() is only called when the page handler's
// timer fires.
TEST_F(TabSearchPageHandlerTest, TabsChanged) {}

// Assert that no browser -> renderer messages are sent when the WebUI is not
// visible.
TEST_F(TabSearchPageHandlerTest, EventsDoNotPropagatedWhenWebUIIsHidden) {}

// Ensure that tab model changes in a browser with a different profile
// will not call TabsChanged().
TEST_F(TabSearchPageHandlerTest, TabsNotChanged) {}

bool VerifyTabUpdated(
    const tab_search::mojom::TabUpdateInfoPtr& tab_update_info) {}

// Verify tab update event is called correctly with data
TEST_F(TabSearchPageHandlerTest, TabUpdated) {}

TEST_F(TabSearchPageHandlerTest, CloseTab) {}

TEST_F(TabSearchPageHandlerTest, RecentlyClosedTab) {}

TEST_F(TabSearchPageHandlerTest, OpenRecentlyClosedTab) {}

TEST_F(TabSearchPageHandlerTest, RecentlyClosedTabsHaveNoRepeatedURLEntry) {}

TEST_F(TabSearchPageHandlerTest,
       RecentlyClosedTabGroupsHaveNoRepeatedURLEntries) {}

TEST_F(TabSearchPageHandlerTest, RecentlyClosedTabEntriesFilterOpenTabUrls) {}

TEST_F(TabSearchPageHandlerTest, RecentlyClosedSectionExpandedUserPref) {}

TEST_F(TabSearchPageHandlerTest, TabDataToMojo) {}

TEST_F(TabSearchPageHandlerTest, TabOrganizationToMojo) {}

TEST_F(TabSearchPageHandlerTest, TabOrganizationSessionToMojo) {}

TEST_F(TabSearchPageHandlerTest, TabOrganizationSessionObservation) {}

TEST_F(TabSearchPageHandlerTest,
       TabOrganizationSessionObservationWrongProfile) {}

}  // namespace