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

Side by Side Diff: util/mach/exc_client_variants_test.cc

Issue 775943005: UniversalMachExcServer: eliminate multiple implementation inheritance (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 years 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 | « tools/catch_exception_tool.cc ('k') | util/mach/exc_server_variants.h » ('j') | 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 13 matching lines...) Expand all
24 #include "util/mach/exc_server_variants.h" 24 #include "util/mach/exc_server_variants.h"
25 #include "util/mach/exception_behaviors.h" 25 #include "util/mach/exception_behaviors.h"
26 #include "util/mach/mach_extensions.h" 26 #include "util/mach/mach_extensions.h"
27 #include "util/test/mac/mach_errors.h" 27 #include "util/test/mac/mach_errors.h"
28 #include "util/test/mac/mach_multiprocess.h" 28 #include "util/test/mac/mach_multiprocess.h"
29 29
30 namespace crashpad { 30 namespace crashpad {
31 namespace test { 31 namespace test {
32 namespace { 32 namespace {
33 33
34 class TestExcClientVariants : public UniversalMachExcServer, 34 class TestExcClientVariants : public MachMultiprocess,
35 public MachMultiprocess { 35 public UniversalMachExcServer::Interface {
36 public: 36 public:
37 TestExcClientVariants(exception_behavior_t behavior, bool all_fields) 37 TestExcClientVariants(exception_behavior_t behavior, bool all_fields)
38 : UniversalMachExcServer(), 38 : MachMultiprocess(),
39 MachMultiprocess(), 39 UniversalMachExcServer::Interface(),
40 behavior_(behavior), 40 behavior_(behavior),
41 all_fields_(all_fields), 41 all_fields_(all_fields),
42 handled_(false) { 42 handled_(false) {
43 ++exception_; 43 ++exception_;
44 ++exception_code_; 44 ++exception_code_;
45 ++exception_subcode_; 45 ++exception_subcode_;
46 } 46 }
47 47
48 // UniversalMachExcServer: 48 // UniversalMachExcServer::Interface:
49 49
50 virtual kern_return_t CatchMachException( 50 virtual kern_return_t CatchMachException(
51 exception_behavior_t behavior, 51 exception_behavior_t behavior,
52 exception_handler_t exception_port, 52 exception_handler_t exception_port,
53 thread_t thread, 53 thread_t thread,
54 task_t task, 54 task_t task,
55 exception_type_t exception, 55 exception_type_t exception,
56 const mach_exception_data_type_t* code, 56 const mach_exception_data_type_t* code,
57 mach_msg_type_number_t code_count, 57 mach_msg_type_number_t code_count,
58 thread_state_flavor_t* flavor, 58 thread_state_flavor_t* flavor,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 EXPECT_EQ(nullptr, new_state); 128 EXPECT_EQ(nullptr, new_state);
129 } 129 }
130 130
131 return KERN_SUCCESS; 131 return KERN_SUCCESS;
132 } 132 }
133 133
134 private: 134 private:
135 // MachMultiprocess: 135 // MachMultiprocess:
136 136
137 void MachMultiprocessParent() override { 137 void MachMultiprocessParent() override {
138 UniversalMachExcServer universal_mach_exc_server(this);
139
138 kern_return_t kr = 140 kern_return_t kr =
139 MachMessageServer::Run(this, 141 MachMessageServer::Run(&universal_mach_exc_server,
140 LocalPort(), 142 LocalPort(),
141 MACH_MSG_OPTION_NONE, 143 MACH_MSG_OPTION_NONE,
142 MachMessageServer::kOneShot, 144 MachMessageServer::kOneShot,
143 MachMessageServer::kBlocking, 145 MachMessageServer::kBlocking,
144 MachMessageServer::kReceiveLargeError, 146 MachMessageServer::kReceiveLargeError,
145 0); 147 0);
146 EXPECT_EQ(KERN_SUCCESS, kr) 148 EXPECT_EQ(KERN_SUCCESS, kr)
147 << MachErrorMessage(kr, "MachMessageServer::Run"); 149 << MachErrorMessage(kr, "MachMessageServer::Run");
148 150
149 EXPECT_TRUE(handled_); 151 EXPECT_TRUE(handled_);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 286
285 TestExcClientVariants test_exc_client_variants(behavior, true); 287 TestExcClientVariants test_exc_client_variants(behavior, true);
286 test_exc_client_variants.Run(); 288 test_exc_client_variants.Run();
287 } 289 }
288 } 290 }
289 } 291 }
290 292
291 } // namespace 293 } // namespace
292 } // namespace test 294 } // namespace test
293 } // namespace crashpad 295 } // namespace crashpad
OLDNEW
« no previous file with comments | « tools/catch_exception_tool.cc ('k') | util/mach/exc_server_variants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698