#include "content/public/browser/tracing_controller.h"
#include <stdint.h>
#include <optional>
#include <utility>
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/json/json_reader.h"
#include "base/memory/ref_counted_memory.h"
#include "base/run_loop.h"
#include "base/strings/pattern.h"
#include "base/task/task_traits.h"
#include "base/threading/thread_restrictions.h"
#include "base/values.h"
#include "build/build_config.h"
#include "build/chromecast_buildflags.h"
#include "build/chromeos_buildflags.h"
#include "content/browser/tracing/tracing_controller_impl.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/shell/browser/shell.h"
#include "content/test/test_content_browser_client.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/tracing/public/cpp/perfetto/trace_event_data_source.h"
#include "services/tracing/public/cpp/trace_event_agent.h"
#include "services/tracing/public/cpp/tracing_features.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chromeos/ash/components/dbus/debug_daemon/debug_daemon_client.h"
#include "chromeos/ash/components/system/fake_statistics_provider.h"
#include "chromeos/ash/components/system/statistics_provider.h"
#endif
RECORD_CONTINUOUSLY;
RECORD_UNTIL_FULL;
TraceConfig;
namespace content {
namespace {
bool KeyEquals(const base::Value::Dict& dict,
const char* key_name,
const char* expected) { … }
bool KeyNotEquals(const base::Value::Dict& dict,
const char* key_name,
const char* expected) { … }
}
class TracingControllerTestEndpoint
: public TracingController::TraceDataEndpoint { … };
class TracingControllerTest : public ContentBrowserTest { … };
#if BUILDFLAG(IS_ANDROID) && defined(ADDRESS_SANITIZER)
#define MAYBE_EnableAndStopTracing …
#define MAYBE_DisableRecordingStoresMetadata …
#define MAYBE_NotWhitelistedMetadataStripped …
#define MAYBE_EnableAndStopTracingWithFilePath …
#define MAYBE_EnableAndStopTracingWithCompression …
#define MAYBE_EnableAndStopTracingWithEmptyFile …
#define MAYBE_DoubleStopTracing …
#define MAYBE_ProcessesPresentInTrace …
#else
#define MAYBE_EnableAndStopTracing …
#define MAYBE_DisableRecordingStoresMetadata …
#define MAYBE_NotWhitelistedMetadataStripped …
#define MAYBE_EnableAndStopTracingWithFilePath …
#define MAYBE_EnableAndStopTracingWithCompression …
#define MAYBE_EnableAndStopTracingWithEmptyFile …
#define MAYBE_DoubleStopTracing …
#define MAYBE_ProcessesPresentInTrace …
#endif
IN_PROC_BROWSER_TEST_F(TracingControllerTest, GetCategories) { … }
IN_PROC_BROWSER_TEST_F(TracingControllerTest, MAYBE_EnableAndStopTracing) { … }
IN_PROC_BROWSER_TEST_F(TracingControllerTest,
MAYBE_DisableRecordingStoresMetadata) { … }
IN_PROC_BROWSER_TEST_F(TracingControllerTest,
MAYBE_NotWhitelistedMetadataStripped) { … }
IN_PROC_BROWSER_TEST_F(TracingControllerTest,
MAYBE_EnableAndStopTracingWithFilePath) { … }
IN_PROC_BROWSER_TEST_F(TracingControllerTest,
MAYBE_EnableAndStopTracingWithCompression) { … }
IN_PROC_BROWSER_TEST_F(TracingControllerTest,
MAYBE_EnableAndStopTracingWithEmptyFile) { … }
IN_PROC_BROWSER_TEST_F(TracingControllerTest, MAYBE_DoubleStopTracing) { … }
#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CASTOS)
#define MAYBE_SystemTraceEvents …
#else
#define MAYBE_SystemTraceEvents …
#endif
IN_PROC_BROWSER_TEST_F(TracingControllerTest, MAYBE_SystemTraceEvents) { … }
IN_PROC_BROWSER_TEST_F(TracingControllerTest, MAYBE_ProcessesPresentInTrace) { … }
}