Fix network service setup/teardown code in unit tests.

There are three fixes:
1) The main fix is that network::NetworkService needs to be torn down between tests. One reason is that so a test don't leave it misconfigured for other tests. The pressing reason is that if network::NetworkService is bound to a pipe in one test it'll also be bound to that test's BrowserThreadTestBundle's sequence; that means for other tests no mojo messages will be dispatched. Fix this by resetting the interface pointer at the end of each test.

2) We need to delete the network::NetworkService object to avoid leaks; depending on connection error dispatching again might not be delivered. This is fixed by storing the pointer in SequenceLocalStorageSlot.

3) We create network::NetworkService directly instead of trying to use the global ServiceManager. For most tests this happens because there's no global Connector. However some tests would instantiate a test service manager objects, so we need to force the direct instantiation through a test only method.

Bug: 966633
Change-Id: I1c181733af692e7a6742a45c10a16c863e2642a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1632494
Commit-Queue: John Abd-El-Malek <[email protected]>
Reviewed-by: Ken Rockot <[email protected]>
Cr-Commit-Position: refs/heads/master@{#664068}
diff --git a/content/browser/network_service_restart_browsertest.cc b/content/browser/network_service_restart_browsertest.cc
index 1eb5cfc..2aca979f 100644
--- a/content/browser/network_service_restart_browsertest.cc
+++ b/content/browser/network_service_restart_browsertest.cc
@@ -12,6 +12,7 @@
 #include "build/build_config.h"
 #include "content/browser/frame_host/render_frame_host_impl.h"
 #include "content/browser/frame_host/render_frame_message_filter.h"
+#include "content/browser/network_service_instance_impl.h"
 #include "content/browser/renderer_host/render_process_host_impl.h"
 #include "content/browser/service_worker/embedded_worker_instance.h"
 #include "content/browser/service_worker/embedded_worker_status.h"