#include "content/public/test/web_ui_browsertest_util.h"
#include <memory>
#include <string>
#include <string_view>
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/hash/hash.h"
#include "base/memory/ref_counted_memory.h"
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/threading/thread_restrictions.h"
#include "content/browser/webui/web_ui_impl.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_controller.h"
#include "content/public/browser/web_ui_data_source.h"
#include "content/public/common/bindings_policy.h"
#include "content/public/common/content_paths.h"
#include "content/public/common/url_constants.h"
#include "net/base/url_util.h"
#include "services/network/public/mojom/content_security_policy.mojom.h"
#include "url/gurl.h"
namespace content {
namespace {
void GetResource(const std::string& id,
WebUIDataSource::GotDataCallback callback) { … }
struct WebUIControllerConfig { … };
class TestWebUIController : public WebUIController { … };
std::unique_ptr<WebUIController> CreateTestWebUIControllerForURL(
WebUI* web_ui,
const GURL& url,
bool disable_xfo) { … }
}
WebUIControllerConfig::WebUIControllerConfig() = default;
WebUIControllerConfig::~WebUIControllerConfig() = default;
TestWebUIController::TestWebUIController(WebUI* web_ui,
const GURL& base_url,
const WebUIControllerConfig& config)
: … { … }
TestUntrustedDataSourceHeaders::TestUntrustedDataSourceHeaders() = default;
TestUntrustedDataSourceHeaders::TestUntrustedDataSourceHeaders(
const TestUntrustedDataSourceHeaders& other) = default;
TestUntrustedDataSourceHeaders::~TestUntrustedDataSourceHeaders() = default;
void AddUntrustedDataSource(
BrowserContext* browser_context,
const std::string& host,
std::optional<TestUntrustedDataSourceHeaders> headers) { … }
GURL GetChromeUntrustedUIURL(const std::string& host_and_path) { … }
TestWebUIConfig::TestWebUIConfig(std::string_view host)
: … { … }
std::unique_ptr<WebUIController> TestWebUIConfig::CreateWebUIController(
content::WebUI* web_ui,
const GURL& url) { … }
TestWebUIControllerFactory::TestWebUIControllerFactory()
: … { … }
std::unique_ptr<WebUIController>
TestWebUIControllerFactory::CreateWebUIControllerForURL(WebUI* web_ui,
const GURL& url) { … }
WebUI::TypeID TestWebUIControllerFactory::GetWebUIType(
BrowserContext* browser_context,
const GURL& url) { … }
bool TestWebUIControllerFactory::UseWebUIForURL(BrowserContext* browser_context,
const GURL& url) { … }
void TestWebUIControllerFactory::SetSupportedScheme(const std::string& scheme) { … }
}