-
Notifications
You must be signed in to change notification settings - Fork 281
Expand file tree
/
Copy pathTraceLoggingTests.cpp
More file actions
38 lines (29 loc) · 1.19 KB
/
TraceLoggingTests.cpp
File metadata and controls
38 lines (29 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "pch.h"
// Just verify that Tracelogging.h compiles.
#define PROVIDER_CLASS_NAME TestProvider
#include "TraceLoggingTests.h"
#include "catch.hpp"
#include "common.h"
TEST_CASE("TraceLoggingTests::ActivitySuspendResume", "[tracelogging]")
{
// Test that Activity classes implement the suspend/resume interface for coroutine watchers.
// This interface is used by wil::with_watcher() to pause error watching during co_await.
auto activity = TestProvider::TraceloggingActivity::Start();
// Initially watching after Start()
REQUIRE(activity.IsRunning());
// suspend() should return true (was watching) and stop watching
bool wasWatching = activity.suspend();
REQUIRE(wasWatching);
REQUIRE_FALSE(activity.IsWatching());
// Calling suspend() again should return false (wasn't watching)
wasWatching = activity.suspend();
REQUIRE_FALSE(wasWatching);
REQUIRE_FALSE(activity.IsWatching());
// resume() should restart watching
activity.resume();
REQUIRE(activity.IsWatching());
// Calling resume() when already watching is safe
activity.resume();
REQUIRE(activity.IsWatching());
activity.Stop();
}