MCPcopy Create free account
hub / github.com/apache/brpc / TEST_F

Function TEST_F

test/brpc_controller_unittest.cpp:44–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44TEST_F(ControllerTest, notify_on_failed) {
45 brpc::SocketId id = 0;
46 ASSERT_EQ(0, brpc::Socket::Create(brpc::SocketOptions(), &id));
47
48 brpc::Controller cntl;
49 cntl._current_call.peer_id = id;
50 ASSERT_FALSE(cntl.IsCanceled());
51
52 bool cancel = false;
53 cntl.NotifyOnCancel(brpc::NewCallback(&MyCancelCallback, &cancel));
54 // Trigger callback
55 brpc::Socket::SetFailed(id);
56 usleep(20000); // sleep a while to wait for the canceling which will be
57 // happening in another thread.
58 ASSERT_TRUE(cancel);
59 ASSERT_TRUE(cntl.IsCanceled());
60}
61
62TEST_F(ControllerTest, notify_on_destruction) {
63 brpc::SocketId id = 0;

Callers

nothing calls this directly

Calls 12

SocketOptionsClass · 0.85
NewCallbackFunction · 0.85
SetLogSinkFunction · 0.85
endsWithFunction · 0.85
startsWithFunction · 0.85
IsCanceledMethod · 0.80
NotifyOnCancelMethod · 0.80
set_request_idMethod · 0.80
set_log_idMethod · 0.45
SetMethod · 0.45
GetMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected