OLD | NEW |
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 const char kTestMemory[] = "Some test memory"; | 37 const char kTestMemory[] = "Some test memory"; |
38 char buffer[arraysize(kTestMemory)]; | 38 char buffer[arraysize(kTestMemory)]; |
39 ASSERT_TRUE( | 39 ASSERT_TRUE( |
40 process_reader.ReadMemory(reinterpret_cast<uintptr_t>(kTestMemory), | 40 process_reader.ReadMemory(reinterpret_cast<uintptr_t>(kTestMemory), |
41 sizeof(kTestMemory), | 41 sizeof(kTestMemory), |
42 &buffer)); | 42 &buffer)); |
43 EXPECT_STREQ(kTestMemory, buffer); | 43 EXPECT_STREQ(kTestMemory, buffer); |
44 } | 44 } |
45 | 45 |
| 46 TEST(ProcessReaderWin, SelfOneThread) { |
| 47 ProcessReaderWin process_reader; |
| 48 ASSERT_TRUE(process_reader.Initialize(GetCurrentProcess())); |
| 49 |
| 50 const std::vector<ProcessReaderWin::Thread>& threads = |
| 51 process_reader.Threads(); |
| 52 |
| 53 // If other tests ran in this process previously, threads may have been |
| 54 // created and may still be running. This check must look for at least one |
| 55 // thread, not exactly one thread. |
| 56 ASSERT_GE(threads.size(), 1u); |
| 57 |
| 58 EXPECT_EQ(GetThreadId(GetCurrentThread()), threads[0].id); |
| 59 #if defined(ARCH_CPU_64_BITS) |
| 60 EXPECT_NE(0, threads[0].context.Rip); |
| 61 #else |
| 62 EXPECT_NE(0, threads[0].context.Eip); |
| 63 #endif |
| 64 |
| 65 EXPECT_EQ(0, threads[0].suspend_count); |
| 66 } |
| 67 |
46 } // namespace | 68 } // namespace |
47 } // namespace test | 69 } // namespace test |
48 } // namespace crashpad | 70 } // namespace crashpad |
OLD | NEW |