#include "base/command_line.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/strcat.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/bind.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/back_forward_cache.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/isolated_world_ids.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 "content/public/test/test_navigation_observer.h"
#include "content/public/test/test_utils.h"
#include "content/public/test/url_loader_interceptor.h"
#include "content/public/test/url_loader_monitor.h"
#include "net/base/features.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "services/network/public/cpp/resource_request.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
HasSubstr;
ContainsRegex;
namespace {
const char kTestHtml[] = …;
const char kTestNavigationHtml[] = …;
const char kTestMedia[] = …;
}
class ViewSourceTest : public InProcessBrowserTest { … };
class ViewSourcePermissionsPolicyTest : public ViewSourceTest { … };
IN_PROC_BROWSER_TEST_F(ViewSourceTest, DoesBrowserRenderInViewSource) { … }
IN_PROC_BROWSER_TEST_F(ViewSourceTest, DoesBrowserConsumeViewSourcePrefix) { … }
IN_PROC_BROWSER_TEST_F(ViewSourceTest, ViewSourceInMenuEnabledOnANormalPage) { … }
IN_PROC_BROWSER_TEST_F(ViewSourceTest, ViewSourceInMenuDisabledOnAMediaPage) { … }
IN_PROC_BROWSER_TEST_F(ViewSourceTest,
ViewSourceInMenuDisabledWhileViewingSource) { … }
IN_PROC_BROWSER_TEST_F(ViewSourceTest, DISABLED_TestViewSourceReload) { … }
IN_PROC_BROWSER_TEST_F(ViewSourceTest,
ViewSourceCrossProcessAndBack) { … }
IN_PROC_BROWSER_TEST_F(ViewSourceTest, CrossSiteSubframe) { … }
IN_PROC_BROWSER_TEST_F(ViewSourceTest, HttpPostInMainframe) { … }
IN_PROC_BROWSER_TEST_F(ViewSourceTest,
ViewSourceWithRenderFrameHostWithoutCommit) { … }
class ViewSourceWithSplitCacheTest
: public ViewSourceTest,
public ::testing::WithParamInterface<bool> { … };
IN_PROC_BROWSER_TEST_P(ViewSourceWithSplitCacheTest, HttpPostInSubframe) { … }
INSTANTIATE_TEST_SUITE_P(…);
ViewSourceWithSplitCacheEnabledTest;
IN_PROC_BROWSER_TEST_P(ViewSourceWithSplitCacheEnabledTest,
NetworkIsolationKeyReusedForBackNavigation) { … }
INSTANTIATE_TEST_SUITE_P(…);
IN_PROC_BROWSER_TEST_F(ViewSourceTest, NavigationOmitsReferrer) { … }
IN_PROC_BROWSER_TEST_F(ViewSourceTest, JavaScriptURISanitized) { … }
IN_PROC_BROWSER_TEST_F(ViewSourcePermissionsPolicyTest,
ViewSourceNotAffectedByHeaderPolicy) { … }
namespace {
class ViewSourcePrerenderTest : public ViewSourceTest { … };
IN_PROC_BROWSER_TEST_F(ViewSourcePrerenderTest, ViewSourceForPrerender) { … }
}