Avoid leaking SystemNetworkContextManager between PlatformUtilTest tests.

On ChromeOS, PlatformUtilTest tests indirectly result in the global
SystemNetworkContextManager instance being set, initialized with the
local state PrefService owned by the TestProfileManager managed by
BrowserWithTestWindowTest. When the second test in the fixture runs, the
retained PrefService pointer is dangling, resulting in a use-after-free.

Add a conditional SystemNetworkContextManager cleanup to
BrowserWithTestWindowTest::TearDown() to avoid leaking it between tests.

Re-enable PlatformUtilTest.OpenFolder now that it passes reliably.

Bug: 1004639
Change-Id: I03c9d06cb98c258a3db8741e6f2576f887cdb705
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1821697
Commit-Queue: Noel Gordon <[email protected]>
Reviewed-by: John Abd-El-Malek <[email protected]>
Reviewed-by: Noel Gordon <[email protected]>
Cr-Commit-Position: refs/heads/master@{#699473}
diff --git a/chrome/browser/platform_util_unittest.cc b/chrome/browser/platform_util_unittest.cc
index ff182eb4..f939760 100644
--- a/chrome/browser/platform_util_unittest.cc
+++ b/chrome/browser/platform_util_unittest.cc
@@ -212,13 +212,7 @@
   EXPECT_EQ(OPEN_FAILED_PATH_NOT_FOUND, CallOpenItem(nowhere_, OPEN_FILE));
 }
 
-// TODO(crbug.com/1004639) Disabled on Linux due to crashes and timeouts.
-#if defined(OS_LINUX)
-#define MAYBE_OpenFolder DISABLED_OpenFolder
-#else
-#define MAYBE_OpenFolder OpenFolder
-#endif
-TEST_F(PlatformUtilTest, MAYBE_OpenFolder) {
+TEST_F(PlatformUtilTest, OpenFolder) {
   EXPECT_EQ(OPEN_SUCCEEDED, CallOpenItem(existing_folder_, OPEN_FOLDER));
   EXPECT_EQ(OPEN_FAILED_INVALID_TYPE,
             CallOpenItem(existing_file_, OPEN_FOLDER));