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

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

Issue 777993002: MachMessageServer: eliminate argument redundancy (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Rebase 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 | « util/mach/exc_server_variants_test.cc ('k') | util/mach/mach_message.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 10 matching lines...) Expand all
21 21
22 #include "base/basictypes.h" 22 #include "base/basictypes.h"
23 #include "base/logging.h" 23 #include "base/logging.h"
24 #include "base/mac/mach_logging.h" 24 #include "base/mac/mach_logging.h"
25 #include "base/mac/scoped_mach_port.h" 25 #include "base/mac/scoped_mach_port.h"
26 #include "base/strings/stringprintf.h" 26 #include "base/strings/stringprintf.h"
27 #include "gtest/gtest.h" 27 #include "gtest/gtest.h"
28 #include "util/file/fd_io.h" 28 #include "util/file/fd_io.h"
29 #include "util/mach/exc_server_variants.h" 29 #include "util/mach/exc_server_variants.h"
30 #include "util/mach/mach_extensions.h" 30 #include "util/mach/mach_extensions.h"
31 #include "util/mach/mach_message.h"
32 #include "util/mach/mach_message_server.h"
31 #include "util/misc/scoped_forbid_return.h" 33 #include "util/misc/scoped_forbid_return.h"
32 #include "util/synchronization/semaphore.h" 34 #include "util/synchronization/semaphore.h"
33 #include "util/test/mac/mach_errors.h" 35 #include "util/test/mac/mach_errors.h"
34 #include "util/test/mac/mach_multiprocess.h" 36 #include "util/test/mac/mach_multiprocess.h"
35 37
36 namespace crashpad { 38 namespace crashpad {
37 namespace test { 39 namespace test {
38 namespace { 40 namespace {
39 41
40 // Calls GetExceptionPorts() on its |exception_ports| argument to look up the 42 // Calls GetExceptionPorts() on its |exception_ports| argument to look up the
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 CheckedWriteFD(WritePipeFD(), &c, 1); 445 CheckedWriteFD(WritePipeFD(), &c, 1);
444 446
445 if (who_crashes_ != kNobodyCrashes) { 447 if (who_crashes_ != kNobodyCrashes) {
446 UniversalMachExcServer universal_mach_exc_server(this); 448 UniversalMachExcServer universal_mach_exc_server(this);
447 449
448 kern_return_t kr = 450 kern_return_t kr =
449 MachMessageServer::Run(&universal_mach_exc_server, 451 MachMessageServer::Run(&universal_mach_exc_server,
450 local_port, 452 local_port,
451 MACH_MSG_OPTION_NONE, 453 MACH_MSG_OPTION_NONE,
452 MachMessageServer::kOneShot, 454 MachMessageServer::kOneShot,
453 MachMessageServer::kBlocking,
454 MachMessageServer::kReceiveLargeError, 455 MachMessageServer::kReceiveLargeError,
455 0); 456 kMachMessageTimeoutWaitIndefinitely);
456 EXPECT_EQ(KERN_SUCCESS, kr) 457 EXPECT_EQ(KERN_SUCCESS, kr)
457 << MachErrorMessage(kr, "MachMessageServer::Run"); 458 << MachErrorMessage(kr, "MachMessageServer::Run");
458 459
459 EXPECT_TRUE(handled_); 460 EXPECT_TRUE(handled_);
460 } 461 }
461 462
462 // Wait for the child process to exit or terminate, as indicated by it 463 // Wait for the child process to exit or terminate, as indicated by it
463 // closing its pipe. This keeps LocalPort() alive in the child as 464 // closing its pipe. This keeps LocalPort() alive in the child as
464 // RemotePort(), for the child’s use in its TestGetExceptionPorts(). 465 // RemotePort(), for the child’s use in its TestGetExceptionPorts().
465 CheckedReadFDAtEOF(ReadPipeFD()); 466 CheckedReadFDAtEOF(ReadPipeFD());
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 if (geteuid() == 0) { 574 if (geteuid() == 0) {
574 EXPECT_TRUE(rv); 575 EXPECT_TRUE(rv);
575 } else { 576 } else {
576 EXPECT_FALSE(rv); 577 EXPECT_FALSE(rv);
577 } 578 }
578 } 579 }
579 580
580 } // namespace 581 } // namespace
581 } // namespace test 582 } // namespace test
582 } // namespace crashpad 583 } // namespace crashpad
OLDNEW
« no previous file with comments | « util/mach/exc_server_variants_test.cc ('k') | util/mach/mach_message.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698