chromium/chrome/browser/ui/side_search/side_search_tab_contents_helper_interactive_uitest.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 "base/test/bind.h"
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/browser/ui/side_search/side_search_tab_contents_helper.h"

#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/extensions/chrome_test_extension_loader.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/side_search/side_search_config.h"
#include "chrome/browser/ui/side_search/side_search_utils.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "chrome/test/interaction/interactive_browser_test.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/result_codes.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_navigation_observer.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_id.h"
#include "extensions/common/manifest.h"
#include "extensions/test/test_extension_dir.h"
#include "net/dns/mock_host_resolver.h"
#include "services/network/test/test_url_loader_factory.h"
#include "ui/base/interaction/element_identifier.h"

namespace {

DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE();

constexpr char kSearchMatchPath[] =;
constexpr char kNonMatchPath[] =;

bool IsSearchURLMatch(const GURL& url) {}

}  // namespace

class SideSearchSideContentsHelperBrowsertest : public InteractiveBrowserTest {};

// Base class for Extensions API tests for the side panel WebContents.
class SideSearchExtensionsTest
    : public SideSearchSideContentsHelperBrowsertest {};

#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
// TODO(crbug.com/40230340): Test is flaky on Mac and Linux.
#define MAYBE_ContentScriptsExecuteInSidePanel
#else
#define MAYBE_ContentScriptsExecuteInSidePanel
#endif
IN_PROC_BROWSER_TEST_F(SideSearchExtensionsTest,
                       MAYBE_ContentScriptsExecuteInSidePanel) {}

#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
// TODO(crbug.com/40230491): Test is flaky on Mac and Linux.
#define MAYBE_WebRequestInterceptsSidePanelNavigations
#else
#define MAYBE_WebRequestInterceptsSidePanelNavigations
#endif
IN_PROC_BROWSER_TEST_F(SideSearchExtensionsTest,
                       MAYBE_WebRequestInterceptsSidePanelNavigations) {}

#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
// TODO(crbug.com/40827415): Test is flaky on Mac, Windows and Linux bots.
#define MAYBE_DeclarativeNetRequestInterceptsSidePanelNavigations
#else
#define MAYBE_DeclarativeNetRequestInterceptsSidePanelNavigations
#endif
IN_PROC_BROWSER_TEST_F(
    SideSearchExtensionsTest,
    MAYBE_DeclarativeNetRequestInterceptsSidePanelNavigations) {}