chromium/third_party/perfetto/src/trace_redaction/scrub_process_stats_integrationtest.cc

/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <cstdint>
#include <string>

#include "perfetto/base/status.h"
#include "src/base/test/status_matchers.h"
#include "src/trace_redaction/collect_timeline_events.h"
#include "src/trace_redaction/scrub_process_stats.h"
#include "src/trace_redaction/trace_redaction_framework.h"
#include "src/trace_redaction/trace_redaction_integration_fixture.h"
#include "src/trace_redaction/trace_redactor.h"
#include "test/gtest_and_gmock.h"

#include "protos/perfetto/trace/ps/process_stats.pbzero.h"
#include "protos/perfetto/trace/trace.pbzero.h"
#include "protos/perfetto/trace/trace_packet.pbzero.h"

namespace perfetto::trace_redaction {

class ScrubProcessStatsTest : public testing::Test,
                              protected TraceRedactionIntegrationFixure {};

// This test is a canary for changes to the test data. If the test data was to
// change, every test in this file would fail.
//
//  SELECT DISTINCT pid
//  FROM process
//  WHERE upid IN (
//    SELECT DISTINCT upid
//    FROM counter
//      JOIN process_counter_track ON counter.track_id=process_counter_track.id
//    WHERE name!='oom_score_adj'
//  )
//  ORDER BY pid
//
//  NOTE: WHERE name!='oom_score_adj' is used because there are two sources for
//  oom_score_adj values and we only want process stats here.
TEST_F(ScrubProcessStatsTest, VerifyTraceStats) {}

// Package name: "com.Unity.com.unity.multiplayer.samples.coop"
// Package pid: 7105
TEST_F(ScrubProcessStatsTest, OnlyKeepsStatsForPackage) {}

}  // namespace perfetto::trace_redaction