Remove ScopedTaskEnvironment from NetTestSuite.

Remove global ScopedTaskEnvironment instance that lives across all of
net_unittests.  Add a local variable or test fixture member to whichever
test would crash/fail without that.  Change type from default to IO
for whichever test would crash/fail without that.

In some cases, like HttpServerPropertiesManagerTest, make member private
and add protected accessors.  In most other cases make member protected
and access directly from tests.  I was mostly doing this by occurrence,
and I'm happy to change any test in either direction.

I made scoped_task_environment_ the last member unless it was necessary
to construct it before the constructor of some other members.  I
generally made it a private member, unless it is manipulated from a test
and I was too lazy to write an accessor, or unless it needed to be
created before other, non-private members, because I did not feel like
the ugliness of multiple alternating private and protected sections is
justified.  I'm happy to change this is necessary.

Bug: 791831
Change-Id: I578690820c07264372cff9dbd8bd9c944c243ba8
Reviewed-on: https://chromium-review.googlesource.com/1037405
Commit-Queue: Bence Béky <[email protected]>
Reviewed-by: Helen Li <[email protected]>
Cr-Commit-Position: refs/heads/master@{#556667}
diff --git a/net/test/tcp_socket_proxy_unittest.cc b/net/test/tcp_socket_proxy_unittest.cc
index ea321ad..864404c 100644
--- a/net/test/tcp_socket_proxy_unittest.cc
+++ b/net/test/tcp_socket_proxy_unittest.cc
@@ -12,6 +12,7 @@
 #include "net/socket/tcp_client_socket.h"
 #include "net/socket/tcp_server_socket.h"
 #include "net/test/gtest_util.h"
+#include "net/test/test_with_scoped_task_environment.h"
 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -20,7 +21,7 @@
 
 namespace net {
 
-class TcpSocketProxyTest : public testing::Test {
+class TcpSocketProxyTest : public TestWithScopedTaskEnvironment {
  public:
   TcpSocketProxyTest() : io_thread_("TcpSocketProxyTest IO Thread") {
     EXPECT_TRUE(io_thread_.StartWithOptions(
@@ -104,6 +105,8 @@
   std::unique_ptr<TCPServerSocket> listen_socket_;
 
   std::unique_ptr<TcpSocketProxy> proxy_;
+
+ private:
   IPEndPoint proxy_address_;
 };