chromium/chrome/browser/plugins/pdf_iframe_navigation_throttle_browsertest.cc

// Copyright 2021 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/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/escape.h"
#include "base/test/bind.h"
#include "chrome/browser/plugins/chrome_plugin_service_filter.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/pdf_util.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/plugin_service.h"
#include "content/public/browser/plugin_service_filter.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/prerender_test_util.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "url/gurl.h"

JsReplace;
RenderFrameHost;
TestNavigationManager;
WebContents;
PrerenderHostObserver;
PrerenderHostRegistryObserver;

// We'll use this to block the PDF plugin from loading to force the HTML
// fallback in the NavigationThrottle.
class BlockAllPluginServiceFilter : public content::PluginServiceFilter {};

class PDFIFrameNavigationThrottleBrowserTest : public InProcessBrowserTest {};

// TODO(crbug.com/40180674): The PDF viewer cannot currently be prerendered
// correctly. Once this is supported, this test should be re-enabled. This test
// checks that the throttle is able to navigate the iframe'd PDF to the fallback
// HTML content even while it is prerendering.
IN_PROC_BROWSER_TEST_F(PDFIFrameNavigationThrottleBrowserTest,
                       DISABLED_HTMLFallbackInPrerender) {}