#include <map>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/run_loop.h"
#include "base/synchronization/lock.h"
#include "base/test/bind.h"
#include "build/build_config.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/page.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/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/shell/browser/shell.h"
#include "media/media_buildflags.h"
#include "net/test/embedded_test_server/http_request.h"
#include "ppapi/buildflags/buildflags.h"
#include "third_party/blink/public/common/buildflags.h"
#include "third_party/blink/public/mojom/manifest/manifest.mojom.h"
#if BUILDFLAG(ENABLE_PPAPI)
#include "content/test/ppapi/ppapi_test.h"
#endif
namespace content {
namespace {
class AcceptHeaderTest : public ContentBrowserTest { … };
IN_PROC_BROWSER_TEST_F(AcceptHeaderTest, Check) { … }
#if BUILDFLAG(ENABLE_PPAPI)
IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, PluginAcceptHeader) {
net::EmbeddedTestServer server(net::EmbeddedTestServer::TYPE_HTTP);
server.ServeFilesFromSourceDirectory("ppapi/tests");
base::Lock plugin_accept_header_lock;
std::string plugin_accept_header;
server.RegisterRequestMonitor(base::BindLambdaForTesting(
[&](const net::test_server::HttpRequest& request) {
base::AutoLock lock(plugin_accept_header_lock);
if (request.relative_url == "/test_url_loader_data/hello.txt") {
auto it = request.headers.find("Accept");
if (it != request.headers.end())
plugin_accept_header = it->second;
}
}));
ASSERT_TRUE(server.Start());
RunTestURL(
server.GetURL(BuildQuery("/test_case.html?", "URLLoader_BasicGET")));
{
base::AutoLock lock(plugin_accept_header_lock);
ASSERT_EQ("*/*", plugin_accept_header);
}
ASSERT_TRUE(server.ShutdownAndWaitUntilComplete());
}
#endif
}
}