Move CapturedStderr to test_util library
Bug: 32181382
Test: run /data/nativetest(64)/binderTextOutputTest
Change-Id: Ifb2e1f6af2c3f57b5cbed7dde65efb31253c52a2
diff --git a/include/android-base/test_utils.h b/include/android-base/test_utils.h
index 4ea3c8e..c0bf0c1 100644
--- a/include/android-base/test_utils.h
+++ b/include/android-base/test_utils.h
@@ -48,4 +48,21 @@
DISALLOW_COPY_AND_ASSIGN(TemporaryDir);
};
+class CapturedStderr {
+ public:
+ CapturedStderr();
+ ~CapturedStderr();
+
+ int fd() const;
+
+ private:
+ void init();
+ void reset();
+
+ TemporaryFile temp_file_;
+ int old_stderr_;
+
+ DISALLOW_COPY_AND_ASSIGN(CapturedStderr);
+};
+
#endif // ANDROID_BASE_TEST_UTILS_H