Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: third_party/crashpad/crashpad/snapshot/win/process_reader_win_test.cc

Issue 2773813002: Update Crashpad to 8e37886d418dd042c3c7bfadac99214739ee4d98 (Closed)
Patch Set: Update Crashpad to 8e37886d418dd042c3c7bfadac99214739ee4d98 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 ASSERT_TRUE(process_reader.Initialize(ChildProcess(), 62 ASSERT_TRUE(process_reader.Initialize(ChildProcess(),
63 ProcessSuspensionState::kRunning)); 63 ProcessSuspensionState::kRunning));
64 64
65 #if !defined(ARCH_CPU_64_BITS) 65 #if !defined(ARCH_CPU_64_BITS)
66 EXPECT_FALSE(process_reader.Is64Bit()); 66 EXPECT_FALSE(process_reader.Is64Bit());
67 #else 67 #else
68 EXPECT_TRUE(process_reader.Is64Bit()); 68 EXPECT_TRUE(process_reader.Is64Bit());
69 #endif 69 #endif
70 70
71 WinVMAddress address; 71 WinVMAddress address;
72 CheckedReadFile(ReadPipeHandle(), &address, sizeof(address)); 72 CheckedReadFileExactly(ReadPipeHandle(), &address, sizeof(address));
73 73
74 char buffer[sizeof(kTestMemory)]; 74 char buffer[sizeof(kTestMemory)];
75 ASSERT_TRUE( 75 ASSERT_TRUE(
76 process_reader.ReadMemory(address, sizeof(kTestMemory), &buffer)); 76 process_reader.ReadMemory(address, sizeof(kTestMemory), &buffer));
77 EXPECT_EQ(0, strcmp(kTestMemory, buffer)); 77 EXPECT_EQ(0, strcmp(kTestMemory, buffer));
78 } 78 }
79 79
80 void WinMultiprocessChild() override { 80 void WinMultiprocessChild() override {
81 WinVMAddress address = reinterpret_cast<WinVMAddress>(kTestMemory); 81 WinVMAddress address = reinterpret_cast<WinVMAddress>(kTestMemory);
82 CheckedWriteFile(WritePipeHandle(), &address, sizeof(address)); 82 CheckedWriteFile(WritePipeHandle(), &address, sizeof(address));
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 void ThreadMain() override { 135 void ThreadMain() override {
136 done_->Wait(); 136 done_->Wait();
137 }; 137 };
138 138
139 private: 139 private:
140 Semaphore* done_; 140 Semaphore* done_;
141 }; 141 };
142 142
143 void WinMultiprocessParent() override { 143 void WinMultiprocessParent() override {
144 char c; 144 char c;
145 CheckedReadFile(ReadPipeHandle(), &c, sizeof(c)); 145 CheckedReadFileExactly(ReadPipeHandle(), &c, sizeof(c));
146 ASSERT_EQ(' ', c); 146 ASSERT_EQ(' ', c);
147 147
148 { 148 {
149 ProcessReaderWin process_reader; 149 ProcessReaderWin process_reader;
150 ASSERT_TRUE(process_reader.Initialize(ChildProcess(), 150 ASSERT_TRUE(process_reader.Initialize(ChildProcess(),
151 ProcessSuspensionState::kRunning)); 151 ProcessSuspensionState::kRunning));
152 152
153 const auto& threads = process_reader.Threads(); 153 const auto& threads = process_reader.Threads();
154 ASSERT_GE(threads.size(), kCreatedThreads + 1); 154 ASSERT_GE(threads.size(), kCreatedThreads + 1);
155 for (const auto& thread : threads) 155 for (const auto& thread : threads)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 DISALLOW_COPY_AND_ASSIGN(ProcessReaderChildThreadSuspendCount); 198 DISALLOW_COPY_AND_ASSIGN(ProcessReaderChildThreadSuspendCount);
199 }; 199 };
200 200
201 TEST(ProcessReaderWin, ChildThreadSuspendCounts) { 201 TEST(ProcessReaderWin, ChildThreadSuspendCounts) {
202 WinMultiprocess::Run<ProcessReaderChildThreadSuspendCount>(); 202 WinMultiprocess::Run<ProcessReaderChildThreadSuspendCount>();
203 } 203 }
204 204
205 } // namespace 205 } // namespace
206 } // namespace test 206 } // namespace test
207 } // namespace crashpad 207 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698