MCPcopy Create free account
hub / github.com/OSVR/OSVR-Core / TEST

Function TEST

tests/cplusplus/Connection/AsyncAccessControl.cpp:61–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59};
60
61TEST(AsyncAccessControl, simple) {
62 AsyncAccessControl control;
63 volatile bool sent = false;
64 ASSERT_FALSE(control.mainThreadCTS())
65 << "CTS should have no tasks waiting.";
66
67 ScopedThread asyncThread(new boost::thread([&] {
68 RequestToSend rts(control);
69 ASSERT_TRUE(rts.request()) << "Request should be approved";
70 ASSERT_FALSE(rts.isNested());
71 sent = true;
72 }));
73
74 pleaseSleep();
75 ASSERT_FALSE(sent) << "Shouldn't have been permitted to send yet.";
76 while (!control.mainThreadCTS()) {
77 pleaseYield();
78 }
79 ASSERT_TRUE(sent) << "Should have sent";
80
81 ASSERT_FALSE(control.mainThreadCTS())
82 << "CTS should have no tasks waiting.";
83}
84
85TEST(AsyncAccessControl, serialRequests) {
86 AsyncAccessControl control;

Callers

nothing calls this directly

Calls 5

pleaseSleepFunction · 0.85
pleaseYieldFunction · 0.85
mainThreadCTSMethod · 0.80
requestMethod · 0.80
isNestedMethod · 0.80

Tested by

no test coverage detected