Add missing #include of eintr_wrapper.h to auto_testfile.h. Since it's
Linux-specific, shuffle the files around a bit.

(The implementation is actually POSIX-specific, but it's currently only used
on Linux.)

R=blundell@chromium.org

Review URL: https://breakpad.appspot.com/804002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1240 4c0a9323-5329-0410-9bdc-e9ce6186880e
diff --git a/src/client/linux/minidump_writer/cpu_set_unittest.cc b/src/client/linux/minidump_writer/cpu_set_unittest.cc
index 38fbefd..e2274bd 100644
--- a/src/client/linux/minidump_writer/cpu_set_unittest.cc
+++ b/src/client/linux/minidump_writer/cpu_set_unittest.cc
@@ -36,7 +36,7 @@
 
 #include "breakpad_googletest_includes.h"
 #include "client/linux/minidump_writer/cpu_set.h"
-#include "common/tests/auto_testfile.h"
+#include "common/linux/tests/auto_testfile.h"
 
 using namespace google_breakpad;
 
diff --git a/src/client/linux/minidump_writer/line_reader_unittest.cc b/src/client/linux/minidump_writer/line_reader_unittest.cc
index e3d4a83..29686f0 100644
--- a/src/client/linux/minidump_writer/line_reader_unittest.cc
+++ b/src/client/linux/minidump_writer/line_reader_unittest.cc
@@ -33,7 +33,7 @@
 
 #include "client/linux/minidump_writer/line_reader.h"
 #include "breakpad_googletest_includes.h"
-#include "common/tests/auto_testfile.h"
+#include "common/linux/tests/auto_testfile.h"
 
 using namespace google_breakpad;
 
diff --git a/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc b/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc
index d127b06..6037c7e 100644
--- a/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc
+++ b/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc
@@ -36,7 +36,7 @@
 
 #include "client/linux/minidump_writer/proc_cpuinfo_reader.h"
 #include "breakpad_googletest_includes.h"
-#include "common/tests/auto_testfile.h"
+#include "common/linux/tests/auto_testfile.h"
 
 using namespace google_breakpad;
 
diff --git a/src/common/tests/auto_testfile.h b/src/common/linux/tests/auto_testfile.h
similarity index 86%
rename from src/common/tests/auto_testfile.h
rename to src/common/linux/tests/auto_testfile.h
index 8fd9b50..92fe017 100644
--- a/src/common/tests/auto_testfile.h
+++ b/src/common/linux/tests/auto_testfile.h
@@ -28,25 +28,24 @@
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 // Utility class for creating a temporary file for unit tests
-// that is deleted in the destructor. Only supported on Posix systems.
-#ifndef GOOGLE_BREAKPAD_COMMON_TESTS_AUTO_TESTFILE
-#define GOOGLE_BREAKPAD_COMMON_TESTS_AUTO_TESTFILE
+// that is deleted in the destructor.
+
+#ifndef GOOGLE_BREAKPAD_COMMON_LINUX_TESTS_AUTO_TESTFILE
+#define GOOGLE_BREAKPAD_COMMON_LINUX_TESTS_AUTO_TESTFILE
 
 #include <unistd.h>
 #include <sys/types.h>
+
 #include <string>
 
 #include "breakpad_googletest_includes.h"
+#include "common/linux/eintr_wrapper.h"
 #include "common/tests/auto_tempdir.h"
 
 namespace google_breakpad {
 
-#ifdef _WIN32
-#error "This header cannot be used on Windows"
-#else
-
 class AutoTestFile {
-public:
+ public:
   // Create a new empty test file.
   // test_prefix: (input) test-specific prefix, can't be NULL.
   explicit AutoTestFile(const char* test_prefix) {
@@ -89,13 +88,13 @@
     return fd_;
   }
 
-private:
+ private:
   void Init(const char* test_prefix) {
     fd_ = -1;
     char path_templ[PATH_MAX];
     int ret = snprintf(path_templ, sizeof(path_templ),
-                      TEMPDIR "/%s-unittest.XXXXXX",
-                      test_prefix);
+                       TEMPDIR "/%s-unittest.XXXXXX",
+                       test_prefix);
     if (ret >= static_cast<int>(sizeof(path_templ)))
       return;
 
@@ -107,8 +106,8 @@
   }
 
   void WriteText(const char* text, size_t text_len) {
-    int r = HANDLE_EINTR(write(fd_, text, text_len));
-    if (r != static_cast<int>(text_len)) {
+    ssize_t r = HANDLE_EINTR(write(fd_, text, text_len));
+    if (r != static_cast<ssize_t>(text_len)) {
       close(fd_);
       fd_ = -1;
       return;
@@ -120,8 +119,6 @@
   int fd_;
 };
 
-#endif  // !_WIN32
-
 }  // namespace google_breakpad
 
-#endif  // GOOGLE_BREAKPAD_COMMON_TESTS_AUTO_TESTFILE
+#endif  // GOOGLE_BREAKPAD_COMMON_LINUX_TESTS_AUTO_TESTFILE