#include "base/functional/bind.h"
#include "base/memory/weak_ptr.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "base/timer/elapsed_timer.h"
#include "net/base/io_buffer.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
#include "net/log/net_log_source.h"
#include "net/socket/udp_client_socket.h"
#include "net/socket/udp_server_socket.h"
#include "net/socket/udp_socket.h"
#include "net/test/gtest_util.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/perf/perf_result_reporter.h"
#include "testing/platform_test.h"
IsOk;
namespace net {
namespace {
static constexpr char kMetricPrefixUDPSocket[] = …;
static constexpr char kMetricElapsedTimeMs[] = …;
static constexpr char kMetricWriteSpeedBytesPerSecond[] = …;
perf_test::PerfResultReporter SetUpUDPSocketReporter(const std::string& story) { … }
class UDPSocketPerfTest : public PlatformTest { … };
const int UDPSocketPerfTest::kPacketSize;
void CreateUDPAddress(const std::string& ip_str,
uint16_t port,
IPEndPoint* address) { … }
void UDPSocketPerfTest::WritePacketsToSocket(UDPClientSocket* socket,
int num_of_packets,
base::OnceClosure* done_callback) { … }
void UDPSocketPerfTest::WriteBenchmark(bool use_nonblocking_io) { … }
TEST_F(UDPSocketPerfTest, Write) { … }
TEST_F(UDPSocketPerfTest, WriteNonBlocking) { … }
}
}