#ifndef COMPONENTS_CRONET_ANDROID_TEST_CRONET_TEST_UTIL_H_
#define COMPONENTS_CRONET_ANDROID_TEST_CRONET_TEST_UTIL_H_
#include <jni.h>
#include "base/android/jni_android.h"
#include "base/containers/flat_map.h"
#include "base/memory/scoped_refptr.h"
#include "base/task/single_thread_task_runner.h"
#include "net/base/network_handle.h"
#include "net/quic/quic_context.h"
#include "net/third_party/quiche/src/quiche/quic/core/quic_tag.h"
namespace net {
class URLRequest;
class URLRequestContext;
}
namespace cronet {
class TestUtil {
public:
TestUtil() = delete;
TestUtil(const TestUtil&) = delete;
TestUtil& operator=(const TestUtil&) = delete;
static scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner(
jlong jcontext_adapter);
static net::URLRequestContext* GetURLRequestContext(jlong jcontext_adapter);
static void RunAfterContextInit(jlong jcontext_adapter,
base::OnceClosure task);
static net::URLRequest* GetURLRequest(jlong jrequest_adapter);
static base::flat_map<net::handles::NetworkHandle,
std::unique_ptr<net::URLRequestContext>>*
GetURLRequestContexts(jlong jcontext_adapter);
static net::QuicParams& GetDefaultURLRequestQuicParams(
jlong jcontext_adapter);
private:
static void RunAfterContextInitOnNetworkThread(jlong jcontext_adapter,
base::OnceClosure task);
};
}
#endif