adb: fix shell_service_protocol_test for Windows.

Adds missing #ifdef guards to shell_service_protocol_test.cpp so the
test compiles on Windows.

Also fixes a bug in Windows socketpair write implementation. Previously
it was only checking for a closed pipe if the write happened to block.
This adds an additional pre-check to exit immediately on a closed pipe.

These two changes allow the test to compile and pass on Windows.

Change-Id: Ib8853ed72f015fc0d623da47c32982cb3ffa4a3d
diff --git a/adb/Android.mk b/adb/Android.mk
index 385b1c5..67c3eb7 100644
--- a/adb/Android.mk
+++ b/adb/Android.mk
@@ -133,8 +133,6 @@
     $(LIBADB_TEST_SRCS) \
     $(LIBADB_TEST_linux_SRCS) \
     shell_service_protocol.cpp \
-
-LOCAL_SRC_FILES_linux := \
     shell_service_protocol_test.cpp \
 
 LOCAL_SANITIZE := $(adb_target_sanitize)
@@ -155,11 +153,9 @@
     $(LIBADB_TEST_SRCS) \
     services.cpp \
     shell_service_protocol.cpp \
-
-LOCAL_SRC_FILES_linux := \
-    $(LIBADB_TEST_linux_SRCS) \
     shell_service_protocol_test.cpp \
 
+LOCAL_SRC_FILES_linux := $(LIBADB_TEST_linux_SRCS)
 LOCAL_SRC_FILES_darwin := $(LIBADB_TEST_darwin_SRCS)
 LOCAL_SRC_FILES_windows := $(LIBADB_TEST_windows_SRCS)
 LOCAL_SANITIZE := $(adb_host_sanitize)