|
@@ -21,18 +21,18 @@ using chrono::milliseconds;
|
|
|
using chrono::seconds;
|
|
|
using chrono::steady_clock;
|
|
|
|
|
|
-TestResult *test_connectivity();
|
|
|
-TestResult *test_connectivity_fail_on_wrong_fingerprint();
|
|
|
-TestResult *test_pem();
|
|
|
-TestResult *test_negotiated();
|
|
|
-TestResult *test_reliability();
|
|
|
-TestResult *test_turn_connectivity();
|
|
|
-TestResult *test_track();
|
|
|
-TestResult *test_capi_connectivity();
|
|
|
-TestResult *test_capi_track();
|
|
|
-TestResult *test_websocket();
|
|
|
-TestResult *test_websocketserver();
|
|
|
-TestResult *test_capi_websocketserver();
|
|
|
+TestResult test_connectivity();
|
|
|
+TestResult test_connectivity_fail_on_wrong_fingerprint();
|
|
|
+TestResult test_pem();
|
|
|
+TestResult test_negotiated();
|
|
|
+TestResult test_reliability();
|
|
|
+TestResult test_turn_connectivity();
|
|
|
+TestResult test_track();
|
|
|
+TestResult test_capi_connectivity();
|
|
|
+TestResult test_capi_track();
|
|
|
+TestResult test_websocket();
|
|
|
+TestResult test_websocketserver();
|
|
|
+TestResult test_capi_websocketserver();
|
|
|
size_t benchmark(chrono::milliseconds duration);
|
|
|
|
|
|
void test_benchmark() {
|
|
@@ -46,53 +46,53 @@ void test_benchmark() {
|
|
|
throw runtime_error("Goodput is too low");
|
|
|
}
|
|
|
|
|
|
-TestResult *testCppCleanup() {
|
|
|
+TestResult testCppCleanup() {
|
|
|
try {
|
|
|
// Every created object must have been destroyed, otherwise the wait will block
|
|
|
if (rtc::Cleanup().wait_for(10s) == future_status::timeout)
|
|
|
- return new TestResult(false, "timeout");
|
|
|
- return new TestResult(true);
|
|
|
+ return TestResult(false, "timeout");
|
|
|
+ return TestResult(true);
|
|
|
} catch (const exception &e) {
|
|
|
- return new TestResult(false, e.what());
|
|
|
+ return TestResult(false, e.what());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-TestResult *testCCleanup() {
|
|
|
+TestResult testCCleanup() {
|
|
|
try {
|
|
|
rtcCleanup();
|
|
|
- return new TestResult(true);
|
|
|
+ return TestResult(true);
|
|
|
} catch (const exception &e) {
|
|
|
- return new TestResult(false, e.what());
|
|
|
+ return TestResult(false, e.what());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
static const auto tests = {
|
|
|
// C++ API tests
|
|
|
- new Test("WebRTC connectivity", test_connectivity),
|
|
|
- new Test("WebRTC broken fingerprint", test_connectivity_fail_on_wrong_fingerprint),
|
|
|
- new Test("pem", test_pem),
|
|
|
+ Test("WebRTC connectivity", test_connectivity),
|
|
|
+ Test("WebRTC broken fingerprint", test_connectivity_fail_on_wrong_fingerprint),
|
|
|
+ Test("pem", test_pem),
|
|
|
// TODO: Temporarily disabled as the Open Relay TURN server is unreliable
|
|
|
// new Test("WebRTC TURN connectivity", test_turn_connectivity),
|
|
|
- new Test("WebRTC negotiated DataChannel", test_negotiated),
|
|
|
- new Test("WebRTC reliability mode", test_reliability),
|
|
|
+ Test("WebRTC negotiated DataChannel", test_negotiated),
|
|
|
+ Test("WebRTC reliability mode", test_reliability),
|
|
|
#if RTC_ENABLE_MEDIA
|
|
|
- new Test("WebRTC track", test_track),
|
|
|
+ Test("WebRTC track", test_track),
|
|
|
#endif
|
|
|
#if RTC_ENABLE_WEBSOCKET
|
|
|
// TODO: Temporarily disabled as the echo service is unreliable
|
|
|
// new Test("WebSocket", test_websocket),
|
|
|
- new Test("WebSocketServer", test_websocketserver),
|
|
|
+ Test("WebSocketServer", test_websocketserver),
|
|
|
#endif
|
|
|
- new Test("WebRTC Cpp API cleanup", testCppCleanup),
|
|
|
+ Test("WebRTC Cpp API cleanup", testCppCleanup),
|
|
|
// C API tests
|
|
|
- new Test("WebRTC C API connectivity", test_capi_connectivity),
|
|
|
+ Test("WebRTC C API connectivity", test_capi_connectivity),
|
|
|
#if RTC_ENABLE_MEDIA
|
|
|
- new Test("WebRTC C API track", test_capi_track),
|
|
|
+ Test("WebRTC C API track", test_capi_track),
|
|
|
#endif
|
|
|
#if RTC_ENABLE_WEBSOCKET
|
|
|
- new Test("WebSocketServer C API", test_capi_websocketserver),
|
|
|
+ Test("WebSocketServer C API", test_capi_websocketserver),
|
|
|
#endif
|
|
|
- new Test("WebRTC C API cleanup", testCCleanup),
|
|
|
+ Test("WebRTC C API cleanup", testCCleanup),
|
|
|
};
|
|
|
|
|
|
int main(int argc, char **argv) {
|
|
@@ -103,8 +103,8 @@ int main(int argc, char **argv) {
|
|
|
startTime = steady_clock::now();
|
|
|
|
|
|
for (auto test : tests) {
|
|
|
- auto res = test->run();
|
|
|
- if (res->success) {
|
|
|
+ auto res = test.run();
|
|
|
+ if (res.success) {
|
|
|
success_tests++;
|
|
|
} else {
|
|
|
failed_tests++;
|