Index: snapshot/win/process_reader_win_test.cc |
diff --git a/util/win/time_test.cc b/snapshot/win/process_reader_win_test.cc |
similarity index 51% |
copy from util/win/time_test.cc |
copy to snapshot/win/process_reader_win_test.cc |
index ad0771e38b7889ab92154490845a0c3aafe13782..e7c478ea5b31be431a85c2ea2d659cbcbb1cf04a 100644 |
--- a/util/win/time_test.cc |
+++ b/snapshot/win/process_reader_win_test.cc |
@@ -12,7 +12,9 @@ |
// See the License for the specific language governing permissions and |
// limitations under the License. |
-#include "util/win/time.h" |
+#include "snapshot/win/process_reader_win.h" |
+ |
+#include <windows.h> |
#include "gtest/gtest.h" |
@@ -20,13 +22,25 @@ namespace crashpad { |
namespace test { |
namespace { |
-TEST(Time, Reasonable) { |
- timeval t; |
- GetTimeOfDay(&t); |
- // Assume that time's time_t return is seconds from 1970. |
- time_t approx_now = time(nullptr); |
- EXPECT_GE(approx_now, t.tv_sec); |
- EXPECT_LT(approx_now - 100, t.tv_sec); |
+TEST(ProcessReaderWin, SelfBasic) { |
+ ProcessReaderWin process_reader; |
+ ASSERT_TRUE(process_reader.Initialize(GetCurrentProcess())); |
+ |
+#if !defined(ARCH_CPU_64_BITS) |
+ EXPECT_FALSE(process_reader.Is64Bit()); |
+#else |
+ EXPECT_TRUE(process_reader.Is64Bit()); |
+#endif |
+ |
+ EXPECT_EQ(GetCurrentProcessId(), process_reader.ProcessID()); |
+ |
+ const char kTestMemory[] = "Some test memory"; |
+ char buffer[arraysize(kTestMemory)]; |
+ ASSERT_TRUE( |
+ process_reader.ReadMemory(reinterpret_cast<uintptr_t>(kTestMemory), |
+ sizeof(kTestMemory), |
+ &buffer)); |
+ EXPECT_STREQ(kTestMemory, buffer); |
} |
} // namespace |