#include "src/trace_redaction/redact_sched_events.h"
#include "src/base/test/status_matchers.h"
#include "test/gtest_and_gmock.h"
#include "protos/perfetto/trace/ftrace/ftrace_event.gen.h"
#include "protos/perfetto/trace/ftrace/ftrace_event_bundle.gen.h"
#include "protos/perfetto/trace/ftrace/sched.gen.h"
#include "protos/perfetto/trace/trace.gen.h"
#include "protos/perfetto/trace/trace_packet.gen.h"
namespace perfetto::trace_redaction {
namespace {
constexpr uint64_t kUidA = …;
constexpr uint64_t kUidB = …;
constexpr uint64_t kUidC = …;
constexpr int32_t kNoParent = …;
constexpr int32_t kPidA = …;
constexpr int32_t kPidB = …;
constexpr int32_t kPidC = …;
constexpr int32_t kPidD = …;
constexpr int32_t kCpuA = …;
constexpr int32_t kCpuB = …;
constexpr int32_t kCpuC = …;
constexpr uint64_t kHalfStep = …;
constexpr uint64_t kFullStep = …;
constexpr uint64_t kTimeA = …;
constexpr uint64_t kTimeB = …;
constexpr uint64_t kTimeC = …;
constexpr auto kCommA = …;
constexpr auto kCommB = …;
constexpr auto kCommC = …;
constexpr auto kCommNone = …;
template <int32_t new_pid>
class ChangePidTo : public PidCommModifier { … };
}
class RedactSchedSwitchFtraceEventTest : public testing::Test { … };
TEST_F(RedactSchedSwitchFtraceEventTest, KeepsTargetCommValues) { … }
TEST_F(RedactSchedSwitchFtraceEventTest, RemovesAllCommsIfPackageDoesntExist) { … }
class RedactCompactSchedSwitchTest : public testing::Test { … };
TEST_F(RedactCompactSchedSwitchTest, KeepsTargetCommValues) { … }
TEST_F(RedactCompactSchedSwitchTest, ChangingSharedCommonRetainsComm) { … }
TEST_F(RedactCompactSchedSwitchTest, RemovesAllCommsIfPackageDoesntExist) { … }
TEST_F(RedactCompactSchedSwitchTest, CanChangePid) { … }
class RedactSchedWakingFtraceEventTest : public testing::Test { … };
TEST_F(RedactSchedWakingFtraceEventTest, WakeeKeepsCommWhenConnectedToPackage) { … }
TEST_F(RedactSchedWakingFtraceEventTest,
WakeeLosesCommWhenNotConnectedToPackage) { … }
TEST_F(RedactSchedWakingFtraceEventTest, WakeeKeepsPidWhenConnectedToPackage) { … }
TEST_F(RedactSchedWakingFtraceEventTest,
WakeeLosesPidWhenNotConnectedToPackage) { … }
TEST_F(RedactSchedWakingFtraceEventTest, WakerPidIsLeftUnaffected) { … }
class FilterCompactSchedWakingEventsTest : public testing::Test { … };
TEST_F(FilterCompactSchedWakingEventsTest, FilterCompactSched) { … }
TEST_F(FilterCompactSchedWakingEventsTest,
CorrectsTimeWhenRemovingWakingEvents) { … }
TEST_F(FilterCompactSchedWakingEventsTest, RemovingWakingEventsThrashing) { … }
}