tracing_service_impl_unittest: Avoid internals in ScrapeOnDisconnect

This test is trying to simulate what happens with a remote producer when
it disconnects. The test however uses an in-process producer.

An in-process producer behaves quite differently (compared to a remote
producer). The shared memory arbiter (and the shared memory itself) is
owned by the producer endpoint. There's no way of disconnecting an
in-process producer without destroying its shared memory arbiter. But we
cannot destroy the shared memory arbiter, because the trace writer holds
references to it. We cannot destroy the trace writer, because it would
flush, and scraping will not be exercised.

This commit makes the test more realisting by using a "remote" producer:
* Producer `in_process` can be set to false.
* TestRefSharedMemory is a new type of shared memory that can be used to
  simulate two components having access to the same shared memory in
  tests.
* In order to simulate a disconnection, a ProxyProducerEndpoint can be
  configured to forward all the requests to a real proxy or to drop
  them, after disconnecting.

The test can now own the shared memory arbiter. TracingServiceImpl will
behave as it does with a remote producer and scrape its memory.

+ The production code doesn't contain test only code.
- There's a lot more test-only code required.
+ The test is more realistic.

Change-Id: I61121c6623f912c167876602e93ead39cd087c52
diff --git a/Android.bp b/Android.bp
index 0efdda3..e2f143f 100644
--- a/Android.bp
+++ b/Android.bp
@@ -14932,6 +14932,8 @@
         "src/tracing/test/fake_packet.cc",
         "src/tracing/test/mock_consumer.cc",
         "src/tracing/test/mock_producer.cc",
+        "src/tracing/test/proxy_producer_endpoint.cc",
+        "src/tracing/test/test_shared_memory.cc",
         "src/tracing/test/traced_value_test_support.cc",
     ],
 }