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

Side by Side Diff: util/test/multiprocess_test.cc

Issue 654933002: Use exactly one of final, override, and virtual (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: git grep -E '^ {3,}.*override[ Created 6 years, 2 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
« no previous file with comments | « util/test/multiprocess_exec_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 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 17 matching lines...) Expand all
28 28
29 class TestMultiprocess final : public Multiprocess { 29 class TestMultiprocess final : public Multiprocess {
30 public: 30 public:
31 TestMultiprocess() : Multiprocess() {} 31 TestMultiprocess() : Multiprocess() {}
32 32
33 ~TestMultiprocess() {} 33 ~TestMultiprocess() {}
34 34
35 private: 35 private:
36 // Multiprocess: 36 // Multiprocess:
37 37
38 virtual void MultiprocessParent() override { 38 void MultiprocessParent() override {
39 int read_fd = ReadPipeFD(); 39 int read_fd = ReadPipeFD();
40 char c; 40 char c;
41 CheckedReadFD(read_fd, &c, 1); 41 CheckedReadFD(read_fd, &c, 1);
42 EXPECT_EQ('M', c); 42 EXPECT_EQ('M', c);
43 43
44 pid_t pid; 44 pid_t pid;
45 CheckedReadFD(read_fd, &pid, sizeof(pid)); 45 CheckedReadFD(read_fd, &pid, sizeof(pid));
46 EXPECT_EQ(pid, ChildPID()); 46 EXPECT_EQ(pid, ChildPID());
47 47
48 c = 'm'; 48 c = 'm';
49 CheckedWriteFD(WritePipeFD(), &c, 1); 49 CheckedWriteFD(WritePipeFD(), &c, 1);
50 50
51 // The child will close its end of the pipe and exit. Make sure that the 51 // The child will close its end of the pipe and exit. Make sure that the
52 // parent sees EOF. 52 // parent sees EOF.
53 CheckedReadFDAtEOF(read_fd); 53 CheckedReadFDAtEOF(read_fd);
54 } 54 }
55 55
56 virtual void MultiprocessChild() override { 56 void MultiprocessChild() override {
57 int write_fd = WritePipeFD(); 57 int write_fd = WritePipeFD();
58 58
59 char c = 'M'; 59 char c = 'M';
60 CheckedWriteFD(write_fd, &c, 1); 60 CheckedWriteFD(write_fd, &c, 1);
61 61
62 pid_t pid = getpid(); 62 pid_t pid = getpid();
63 CheckedWriteFD(write_fd, &pid, sizeof(pid)); 63 CheckedWriteFD(write_fd, &pid, sizeof(pid));
64 64
65 CheckedReadFD(ReadPipeFD(), &c, 1); 65 CheckedReadFD(ReadPipeFD(), &c, 1);
66 EXPECT_EQ('m', c); 66 EXPECT_EQ('m', c);
(...skipping 28 matching lines...) Expand all
95 95
96 ~TestMultiprocessUnclean() {} 96 ~TestMultiprocessUnclean() {}
97 97
98 private: 98 private:
99 int ExitCode() const { 99 int ExitCode() const {
100 return type_; 100 return type_;
101 } 101 }
102 102
103 // Multiprocess: 103 // Multiprocess:
104 104
105 virtual void MultiprocessParent() override { 105 void MultiprocessParent() override {
106 } 106 }
107 107
108 virtual void MultiprocessChild() override { 108 void MultiprocessChild() override {
109 if (type_ == kAbort) { 109 if (type_ == kAbort) {
110 abort(); 110 abort();
111 } else { 111 } else {
112 _exit(ExitCode()); 112 _exit(ExitCode());
113 } 113 }
114 } 114 }
115 115
116 TerminationType type_; 116 TerminationType type_;
117 117
118 DISALLOW_COPY_AND_ASSIGN(TestMultiprocessUnclean); 118 DISALLOW_COPY_AND_ASSIGN(TestMultiprocessUnclean);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 CloseReadPipe(); 209 CloseReadPipe();
210 CloseWritePipe(); 210 CloseWritePipe();
211 EXPECT_DEATH(ReadPipeFD(), "fd"); 211 EXPECT_DEATH(ReadPipeFD(), "fd");
212 EXPECT_DEATH(WritePipeFD(), "fd"); 212 EXPECT_DEATH(WritePipeFD(), "fd");
213 break; 213 break;
214 } 214 }
215 } 215 }
216 216
217 // Multiprocess: 217 // Multiprocess:
218 218
219 virtual void MultiprocessParent() override { 219 void MultiprocessParent() override {
220 ASSERT_NO_FATAL_FAILURE(VerifyInitial()); 220 ASSERT_NO_FATAL_FAILURE(VerifyInitial());
221 221
222 if (who_closes_ == kParentCloses) { 222 if (who_closes_ == kParentCloses) {
223 Close(); 223 Close();
224 } else { 224 } else {
225 VerifyPartner(); 225 VerifyPartner();
226 } 226 }
227 } 227 }
228 228
229 virtual void MultiprocessChild() override { 229 void MultiprocessChild() override {
230 ASSERT_NO_FATAL_FAILURE(VerifyInitial()); 230 ASSERT_NO_FATAL_FAILURE(VerifyInitial());
231 231
232 if (who_closes_ == kChildCloses) { 232 if (who_closes_ == kChildCloses) {
233 Close(); 233 Close();
234 } else { 234 } else {
235 VerifyPartner(); 235 VerifyPartner();
236 } 236 }
237 } 237 }
238 238
239 WhoCloses who_closes_; 239 WhoCloses who_closes_;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 TEST(MultiprocessDeathTest, ChildClosesReadAndWritePipe) { 280 TEST(MultiprocessDeathTest, ChildClosesReadAndWritePipe) {
281 TestMultiprocessClosePipe multiprocess( 281 TestMultiprocessClosePipe multiprocess(
282 TestMultiprocessClosePipe::kChildCloses, 282 TestMultiprocessClosePipe::kChildCloses,
283 TestMultiprocessClosePipe::kReadAndWriteClose); 283 TestMultiprocessClosePipe::kReadAndWriteClose);
284 multiprocess.Run(); 284 multiprocess.Run();
285 } 285 }
286 286
287 } // namespace 287 } // namespace
288 } // namespace test 288 } // namespace test
289 } // namespace crashpad 289 } // namespace crashpad
OLDNEW
« no previous file with comments | « util/test/multiprocess_exec_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698