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

Side by Side Diff: third_party/crashpad/crashpad/util/win/exception_handler_server_test.cc

Issue 2478633002: Update Crashpad to b47bf6c250c6b825dee1c5fbad9152c2c962e828 (Closed)
Patch Set: mac comment 2 Created 4 years, 1 month 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 HANDLE server_ready_; // weak 74 HANDLE server_ready_; // weak
75 bool started_; 75 bool started_;
76 76
77 DISALLOW_COPY_AND_ASSIGN(TestDelegate); 77 DISALLOW_COPY_AND_ASSIGN(TestDelegate);
78 }; 78 };
79 79
80 class ExceptionHandlerServerTest : public testing::Test { 80 class ExceptionHandlerServerTest : public testing::Test {
81 public: 81 public:
82 ExceptionHandlerServerTest() 82 ExceptionHandlerServerTest()
83 : server_(true), 83 : server_(true),
84 pipe_name_(server_.CreatePipe()), 84 pipe_name_(L"\\\\.\\pipe\\test_name"),
85 server_ready_(CreateEvent(nullptr, false, false, nullptr)), 85 server_ready_(CreateEvent(nullptr, false, false, nullptr)),
86 delegate_(server_ready_.get()), 86 delegate_(server_ready_.get()),
87 server_thread_(&server_, &delegate_) {} 87 server_thread_(&server_, &delegate_) {
88 server_.SetPipeName(pipe_name_);
89 }
88 90
89 TestDelegate& delegate() { return delegate_; } 91 TestDelegate& delegate() { return delegate_; }
90 ExceptionHandlerServer& server() { return server_; } 92 ExceptionHandlerServer& server() { return server_; }
91 Thread& server_thread() { return server_thread_; } 93 Thread& server_thread() { return server_thread_; }
92 const std::wstring& pipe_name() const { return pipe_name_; } 94 const std::wstring& pipe_name() const { return pipe_name_; }
93 95
94 private: 96 private:
95 ExceptionHandlerServer server_; 97 ExceptionHandlerServer server_;
96 std::wstring pipe_name_; 98 std::wstring pipe_name_;
97 ScopedKernelHANDLE server_ready_; 99 ScopedKernelHANDLE server_ready_;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 ~TestClient() {} 166 ~TestClient() {}
165 167
166 private: 168 private:
167 int Run() override { 169 int Run() override {
168 std::wstring pipe_name = ReadWString(ReadPipeHandle()); 170 std::wstring pipe_name = ReadWString(ReadPipeHandle());
169 CrashpadClient client; 171 CrashpadClient client;
170 if (!client.SetHandlerIPCPipe(pipe_name)) { 172 if (!client.SetHandlerIPCPipe(pipe_name)) {
171 ADD_FAILURE(); 173 ADD_FAILURE();
172 return EXIT_FAILURE; 174 return EXIT_FAILURE;
173 } 175 }
174 if (!client.UseHandler()) {
175 ADD_FAILURE();
176 return EXIT_FAILURE;
177 }
178 WriteWString(WritePipeHandle(), L"OK"); 176 WriteWString(WritePipeHandle(), L"OK");
179 return EXIT_SUCCESS; 177 return EXIT_SUCCESS;
180 } 178 }
181 179
182 DISALLOW_COPY_AND_ASSIGN(TestClient); 180 DISALLOW_COPY_AND_ASSIGN(TestClient);
183 }; 181 };
184 182
185 TEST_F(ExceptionHandlerServerTest, MultipleConnections) { 183 TEST_F(ExceptionHandlerServerTest, MultipleConnections) {
186 WinChildProcess::EntryPoint<TestClient>(); 184 WinChildProcess::EntryPoint<TestClient>();
187 185
(...skipping 18 matching lines...) Expand all
206 204
207 ASSERT_EQ(L"OK", ReadWString(handles_3->read.get())); 205 ASSERT_EQ(L"OK", ReadWString(handles_3->read.get()));
208 ASSERT_EQ(L"OK", ReadWString(handles_2->read.get())); 206 ASSERT_EQ(L"OK", ReadWString(handles_2->read.get()));
209 ASSERT_EQ(L"OK", ReadWString(handles_1->read.get())); 207 ASSERT_EQ(L"OK", ReadWString(handles_1->read.get()));
210 } 208 }
211 } 209 }
212 210
213 } // namespace 211 } // namespace
214 } // namespace test 212 } // namespace test
215 } // namespace crashpad 213 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698