perfetto: refactor test code to consolidate pattern

With several types of testing now present, a clear pattern has been
established in how test code for end to end tests should be written.
This pattern involves spinning up service and producer, setting up a
test-specific trace config and then defining an intricate set of
checkpoints and RunUntilCheckpoint calls.

All of this code is duplicated and this will only get worse as we add
more benchmarks and tests to the codebase. Moreover, the
complex-appearance of the code hides the true simplicity within.

Refactor all the duplicated code into a helper file and call the
functions in this class from the four other cases where they are used
(integration test, fuzzer, benchmark and CTS).

Bug: 74380167
Change-Id: I261636b3da15b16f063e6a5dc6c293080b8ff4ac
diff --git a/Android.bp b/Android.bp
index 4fd984e..44ab92c 100644
--- a/Android.bp
+++ b/Android.bp
@@ -334,9 +334,9 @@
     "src/tracing/core/trace_packet.cc",
     "src/tracing/core/trace_writer_impl.cc",
     "test/end_to_end_integrationtest.cc",
-    "test/fake_consumer.cc",
     "test/fake_producer.cc",
     "test/task_runner_thread.cc",
+    "test/test_helper.cc",
   ],
   shared_libs: [
     "libandroid",
@@ -3549,10 +3549,10 @@
     "src/ftrace_reader/ftrace_procfs.cc",
     "src/ftrace_reader/proto_translation_table.cc",
     "src/traced/probes/probes_producer.cc",
-    "test/fake_producer.cc",
-    "test/fake_consumer.cc",
-    "test/task_runner_thread.cc",
     "test/end_to_end_integrationtest.cc",
+    "test/fake_producer.cc",
+    "test/task_runner_thread.cc",
+    "test/test_helper.cc",
   ],
   export_include_dirs: [
     ".",