@ -27,6 +27,7 @@
# include "src/core/lib/event_engine/thread_pool.h"
# include "src/core/lib/event_engine/windows/iocp.h"
# include "src/core/lib/event_engine/windows/windows_endpoint.h"
# include "src/core/lib/event_engine/windows/windows_engine.h"
# include "src/core/lib/gprpp/notification.h"
# include "src/core/lib/resource_quota/memory_quota.h"
# include "test/core/event_engine/windows/create_sockpair.h"
@ -49,14 +50,15 @@ TEST_F(WindowsEndpointTest, BasicCommunication) {
auto wrapped_client_socket = iocp . Watch ( sockpair [ 0 ] ) ;
auto wrapped_server_socket = iocp . Watch ( sockpair [ 1 ] ) ;
sockaddr_in loopback_addr = GetSomeIpv4LoopbackAddress ( ) ;
auto engine = std : : make_shared < WindowsEventEngine > ( ) ;
EventEngine : : ResolvedAddress addr ( ( sockaddr * ) & loopback_addr ,
sizeof ( loopback_addr ) ) ;
WindowsEndpoint client ( addr , std : : move ( wrapped_client_socket ) ,
quota . CreateMemoryAllocator ( " client " ) ,
ChannelArgsEndpointConfig ( ) , & executor ) ;
ChannelArgsEndpointConfig ( ) , & executor , engine ) ;
WindowsEndpoint server ( addr , std : : move ( wrapped_server_socket ) ,
quota . CreateMemoryAllocator ( " server " ) ,
ChannelArgsEndpointConfig ( ) , & executor ) ;
ChannelArgsEndpointConfig ( ) , & executor , engine ) ;
// Test
std : : string message = " 0xDEADBEEF " ;
grpc_core : : Notification read_done ;
@ -97,11 +99,11 @@ TEST_F(WindowsEndpointTest, Conversation) {
AppState ( const EventEngine : : ResolvedAddress & addr ,
std : : unique_ptr < WinSocket > client ,
std : : unique_ptr < WinSocket > server , grpc_core : : MemoryQuota & quota ,
Executor & executor )
Executor & executor , std : : shared_ptr < EventEngine > engine )
: client ( addr , std : : move ( client ) , quota . CreateMemoryAllocator ( " client " ) ,
ChannelArgsEndpointConfig ( ) , & executor ) ,
ChannelArgsEndpointConfig ( ) , & executor , engine ) ,
server ( addr , std : : move ( server ) , quota . CreateMemoryAllocator ( " server " ) ,
ChannelArgsEndpointConfig ( ) , & executor ) { }
ChannelArgsEndpointConfig ( ) , & executor , engine ) { }
grpc_core : : Notification done ;
WindowsEndpoint client ;
WindowsEndpoint server ;
@ -145,8 +147,9 @@ TEST_F(WindowsEndpointTest, Conversation) {
}
}
} ;
auto engine = std : : make_shared < WindowsEventEngine > ( ) ;
AppState state ( addr , /*client=*/ iocp . Watch ( sockpair [ 0 ] ) ,
/*server=*/ iocp . Watch ( sockpair [ 1 ] ) , quota , executor ) ;
/*server=*/ iocp . Watch ( sockpair [ 1 ] ) , quota , executor , engine ) ;
state . WriteAndQueueReader ( /*writer=*/ & state . client , /*reader=*/ & state . server ) ;
while ( iocp . Work ( 100 ms , [ ] ( ) { } ) = = Poller : : WorkResult : : kOk | |
! state . done . HasBeenNotified ( ) ) {