Revert of Check for CloseHandle failures even when not debugging (patchset #4 id:60001 of https://codereview.chromium.org/1350493002/ )

Reason for revert:
The SharedMemory checks are causing CHECK crashes in the printing system. See bug 533310. Reverting to allow time for an investigation of that underlying problem.

Original issue's description:
> Check for CloseHandle failures even when not debugging
>
> Bug 524267 was a handle closing failure that only showed up when running
> renderer processes under a debugger at startup, so it was not discovered
> for a while.
>
> Similarly, bug 520305 is a long-standing base_unittests bug that only
> shows up under a debugger.
>
> This change fixes 520305 and checks for many handle closing failures
> always so that subsequent bugs of this type will be detected
> immediately.
>
> Most of the CloseHandle calls in base are now checked.
>
> This replaces the uncommitted https://codereview.chromium.org/1343873002/
>
> R=grt@chromium.org,rvargas@chromium.org,dalecurtis@chromium.org
> BUG=524267,520305
>
> Committed: https://crrev.com/9ae49a753d07f5a9266a63a89e7336d774f3fe37
> Cr-Commit-Position: refs/heads/master@{#349333}

TBR=dalecurtis@chromium.org,grt@chromium.org,rvargas@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=524267,520305

Review URL: https://codereview.chromium.org/1356743003

Cr-Commit-Position: refs/heads/master@{#349716}


CrOS-Libchrome-Original-Commit: d350943f049ddcf83b371cf97d652d4d6a8f4f18
diff --git a/base/sync_socket_unittest.cc b/base/sync_socket_unittest.cc
index b3aac6b..ff9b8bc 100644
--- a/base/sync_socket_unittest.cc
+++ b/base/sync_socket_unittest.cc
@@ -89,16 +89,34 @@
   SendReceivePeek(&socket_a, &socket_b);
 }
 
+template <class SocketType>
+void ClonedSendReceivePeek() {
+  SocketType socket_a, socket_b;
+  ASSERT_TRUE(SocketType::CreatePair(&socket_a, &socket_b));
+
+  // Create new SyncSockets from the paired handles.
+  SocketType socket_c(socket_a.handle()), socket_d(socket_b.handle());
+  SendReceivePeek(&socket_c, &socket_d);
+}
+
 }  // namespace
 
 TEST(SyncSocket, NormalSendReceivePeek) {
   NormalSendReceivePeek<base::SyncSocket>();
 }
 
+TEST(SyncSocket, ClonedSendReceivePeek) {
+  ClonedSendReceivePeek<base::SyncSocket>();
+}
+
 TEST(CancelableSyncSocket, NormalSendReceivePeek) {
   NormalSendReceivePeek<base::CancelableSyncSocket>();
 }
 
+TEST(CancelableSyncSocket, ClonedSendReceivePeek) {
+  ClonedSendReceivePeek<base::CancelableSyncSocket>();
+}
+
 TEST(CancelableSyncSocket, CancelReceiveShutdown) {
 // TODO(ellyjones): This test fails on iOS 7 devices. http://crbug.com/523296
 #if defined(OS_IOS) && !TARGET_IPHONE_SIMULATOR