chromium/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.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 <memory>
#include <string>
#include <vector>

#include "base/scoped_observation.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/content_settings/page_specific_content_settings_delegate.h"
#include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/web_applications/test/isolated_web_app_test_utils.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_url_info.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/custom_handlers/protocol_handler.h"
#include "components/custom_handlers/protocol_handler_registry.h"
#include "components/permissions/permission_request_manager.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/fenced_frame_test_util.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "third_party/blink/public/mojom/context_menu/context_menu.mojom.h"
#include "url/url_util.h"

#if BUILDFLAG(IS_MAC)
#include "chrome/test/base/launchservices_utils_mac.h"
#endif

WebContents;
ProtocolHandler;
ProtocolHandlerRegistry;

namespace {

std::string EncodeUrl(const std::string& not_encoded) {}

class ProtocolHandlerChangeWaiter : public ProtocolHandlerRegistry::Observer {};

}  // namespace

class ChromeRegisterProtocolHandlerBrowserTest : public InProcessBrowserTest {};

IN_PROC_BROWSER_TEST_F(ChromeRegisterProtocolHandlerBrowserTest,
                       ContextMenuEntryAppearsForHandledUrls) {}

IN_PROC_BROWSER_TEST_F(ChromeRegisterProtocolHandlerBrowserTest,
                       UnregisterProtocolHandler) {}

IN_PROC_BROWSER_TEST_F(ChromeRegisterProtocolHandlerBrowserTest,
                       CustomHandler) {}

IN_PROC_BROWSER_TEST_F(ChromeRegisterProtocolHandlerBrowserTest,
                       IgnoreRequestWithoutUserGesture) {}

// FencedFrames can not register to handle any protocols.
IN_PROC_BROWSER_TEST_F(ChromeRegisterProtocolHandlerBrowserTest, FencedFrame) {}

RegisterProtocolHandlerExtensionBrowserTest;

IN_PROC_BROWSER_TEST_F(RegisterProtocolHandlerExtensionBrowserTest, Basic) {}

class ChromeRegisterProtocolHandlerAndServiceWorkerInterceptor
    : public InProcessBrowserTest {};

// TODO(crbug.com/40763886): Fix flakiness.
IN_PROC_BROWSER_TEST_F(ChromeRegisterProtocolHandlerAndServiceWorkerInterceptor,
                       DISABLED_RegisterFetchListenerForHTMLHandler) {}

class ChromeRegisterProtocolHandlerIsolatedWebAppsTest
    : public web_app::IsolatedWebAppBrowserTestHarness {};

IN_PROC_BROWSER_TEST_F(ChromeRegisterProtocolHandlerIsolatedWebAppsTest,
                       Basic) {}