48 Commits

Author SHA1 Message Date
Robert Sesek
d88711adfa Add HTTPTransport, a Mac implementation, and an end-to-end test.
BUG=https://crbug.com/415544
R=mark@chromium.org

Review URL: https://codereview.chromium.org/692963002
2014-10-31 12:17:32 -04:00
Robert Sesek
9db5d6f773 Add HTTPMultipartBuilder and its test.
BUG=https://crbug.com/415544
R=mark@chromium.org

Review URL: https://codereview.chromium.org/681303003
2014-10-29 19:13:24 -04:00
Robert Sesek
977a7a8052 Add HTTPBodyStream interface, three concrete implementations, and their tests.
BUG=415544
R=mark@chromium.org

Review URL: https://codereview.chromium.org/669153006
2014-10-24 15:04:25 -04:00
Mark Mentovai
bcae4d94d5 Create snapshot/mac and move some files from snapshot and util to there.
TEST=snapshot_test, util_test CheckedMachAddressRange.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/666483002
2014-10-17 13:41:45 -04:00
Mark Mentovai
2bd5e23ea4 Add ScopedTaskSuspend and its test.
This also introduces ScopedFcntlFlags.

TEST=util_test ScopedTaskSuspend.*:ScopedFcntlFlags.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/649693002
2014-10-13 18:05:21 -04:00
Mark Mentovai
47f17926e4 util_test: specify libbsm link dependency properly.
7dda7b322881 accidentally moved the libbsm.dylib dependency from
util_test_lib to util_test. It is only used by
test/mac/mach_multiprocess.cc in util_test_lib.

Meanwhile, util_test should link against Foundation.framework, which is
used by three tests in util/mac: launchd_test.mm, mac_util_test.mm, and
service_management_test.mm.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/612923004
2014-10-02 18:32:33 -04:00
Scott Graham
7dda7b3228 Superficial gyp changes to not immediately error out on Windows
Just guarding the usage of $SDKROOT so that ninja doesn't error out
on invalid $ escape on parsing.

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/620553004
2014-09-30 13:11:04 -07:00
Mark Mentovai
8decf86db8 Add, test, and use clock utilities.
This includes ClockMonotonicNanoseconds() and SleepNanoseconds().

SleepNanoseconds() is like base::PlatformThread::Sleep(), but
PlatformThread is not in mini_chromium and I’m not keen on adding it
because I’m not sold on the interface. I’m not convinced Sleep() belongs
there, and I don’t want to have to bring all of base::Time* along for
the ride.

TEST=util_test Clock.*:MachMessageServer.*:ServiceManagement.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/597533002
2014-09-24 14:08:48 -04:00
Mark Mentovai
b7a1070335 Add Semaphore and its test, and use it where semaphores are needed.
TEST=util_test Semaphore.*:ProcessReader.*:ExceptionPorts.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/589243003
2014-09-24 13:32:31 -04:00
Mark Mentovai
fee5d8aea9 Add uint128_struct and its test.
This will be used in the upcoming Minidump context structures.

This also updates mini_chromium to ba9b15f1b6a7 to pick up:

ba9b15f1b6a7 Make bit_cast available in C++11 mode.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/583283003
2014-09-22 15:46:00 -04:00
Mark Mentovai
0d8f67c1f5 Specify system framework dependencies properly in .gyp files.
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/588073004
2014-09-22 14:06:06 -04:00
Mark Mentovai
75988925f9 Revert "Drop 10.5 support: use ServiceManagement.framework directly."
This reverts commit 63fd3ae47d2513ef4390c3d8c0dde3fa95152480.

SMJobRemove() still performs a 1-second sleep() when its |wait|
parameter is true. Radar 18398683 is filed. In the mean time, the
launchd-based implementation of these functions does not have this
undesirable property.

The comments have been revised to not reflect operating systems before
Mac OS X 10.6. Comments describing bugs in earlier 10.10 seeds that have
since been fixed have been removed.

TEST=util_test Launchd.*:ServiceManagement.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/579083003
2014-09-22 13:11:40 -04:00
Mark Mentovai
63fd3ae47d Drop 10.5 support: use ServiceManagement.framework directly.
TEST=util_test ServiceManagement.SubmitRemoveJob
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/572323002
2014-09-16 17:45:12 -04:00
Mark Mentovai
8c8089dc77 Add ExceptionPorts and its test.
This is a unified interface to
{thread,task,host}_{get,set}_exception_ports().

TEST=util_test ExceptionPorts.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/549023005
2014-09-16 17:36:33 -04:00
Mark Mentovai
06d48e4b0a Add exception_behaviors and its test.
This includes the functions ExceptionBehaviorHasState(),
ExceptionBehaviorHasIdentity(),
ExceptionBehaviorHasMachExceptionCodes(), and ExceptionBehaviorBasic().

TEST=util_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/565793005
2014-09-16 17:32:35 -04:00
Mark Mentovai
850ec0657d Drop 10.5 support.
TEST=util_test
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/575823002
2014-09-16 11:55:55 -04:00
Mark Mentovai
e49510ab7c Add SymbolicConstantsMach and its test.
TEST=util_test SymbolicConstantsMach.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/563383002
2014-09-16 11:00:51 -04:00
Mark Mentovai
1e7cdb30a0 Add exc_client_variants (UniversalExceptionRaise()) and its test.
This also puts kMachExceptionCodes into mach_extensions.h, because a
form of MACH_EXCEPTION_CODES that’s the right type
(exception_behavior_t) has now shown its use in more than one file.

TEST=util_test ExcClientVariants.UniversalExceptionRaise
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/567283002
2014-09-16 09:48:01 -04:00
Mark Mentovai
a01c87059b Add symbolic_constants_posix and its test.
This includes the functions SignalToString() and StringToSignal().

TEST=util_test SymbolicConstantsPOSIX.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/565453002
2014-09-10 17:30:21 -04:00
Mark Mentovai
177f5dcddc Add exc_server_variants including UniversalMachExcServer and its test.
TEST=util_test ExcServerVariants.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/545053003
2014-09-10 17:29:07 -04:00
Mark Mentovai
10d1b76b90 Add string_number_conversion and its test.
This includes the StringToNumber() function, both int and unsigned int variants.

Similar functionality is available in base, but it is unsuitable for
applications where a number’s base may be determined based on an "0x" or
"0X" prefix (hexadecimal) or an "0" prefix (octal).

TEST=util_test StringNumberConversion.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/557033002
2014-09-10 15:30:11 -04:00
Mark Mentovai
67082c93b9 Add MachMessageServer and its test.
MachMessageServer is much like mach_msg_server() and
mach_msg_server_once(), but with a C++ interface and with a number of
deficiencies corrected.

TEST=util_test MachMessageServer.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/544393002
2014-09-08 21:06:34 -04:00
Mark Mentovai
2cae118b60 Add MachOImageSymbolTableReader and hook it up to MachOImageReader.
TEST=util_test MachOImageReader.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/539263003
2014-09-05 16:53:18 -04:00
Mark Mentovai
5a0b7827ff Run mig to generate the exc and mach_exc interfaces.
mach_exc is necessary because libSystem doesn’t contain this at all. exc
is necessary too, however: the copy in libSystem relies on the server
callbacks being externally defined symbols, which is cheesey.
Additionally, some Crashpad code wants to call internal validation
(“check”) routines that are not normally accessible to outside callers
via the copy of exc in libSystem, but they are made accessible here by
processing mig’s output in this Python script.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/541213002
2014-09-05 13:27:06 -04:00
Mark Mentovai
2f425e744b Add missing dependency on util_test_multiprocess_exec_test_child to
util_test.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/542993002
2014-09-05 12:40:05 -04:00
Mark Mentovai
4f74716f6d Add MachOImageReader and its test, which also tests
MachOImageSegmentReader.

TEST=util_test MachOImageReader.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/535343004
2014-09-04 11:45:40 -04:00
Mark Mentovai
52064fdd1b Add the MultiprocessExec test and its test.
TEST=util_test MultiprocessExec.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/531203002
2014-09-03 18:24:29 -04:00
Mark Mentovai
d492df404c Add CloseMultipleNowOrOnExec().
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/534703003
2014-09-02 16:21:46 -04:00
Mark Mentovai
1460c47d6a Add MachOImageSegmentReader.
This is part of a family of classes whose chief entry point is
MachOImageReader. MachOImageReader depends on this class to read
segments, so this one is landing first. The bulk of this class will be
tested as part of MachOImageReader.

TEST=util_test MachOImageSegmentReader.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/516983003
2014-09-02 15:50:11 -04:00
Mark Mentovai
af0cfd5a57 Add strnlen() wrapper and its test.
TEST=util_test strnlen.strnlen
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/514253002
2014-08-28 14:38:27 -04:00
Mark Mentovai
04842e0ca4 Add CheckedMachAddressRange and its test.
TEST=util_test CheckedMachAddressRange.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/513453002
2014-08-28 13:47:28 -04:00
Mark Mentovai
ff26ea6db9 Refactor MachMultiprocess into a Multiprocess base class without any
knowledge of Mach. MachMultiprocess builds on this new base class.

TEST=util_test MachMultiprocess.*:Multiprocess.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/506143002
2014-08-26 17:10:19 -04:00
Mark Mentovai
30589d87a9 Add ProcessTypes, its test, and many proctype definition files.
TEST=util_test ProcessTypes.DyldImagesSelf
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/501203002
2014-08-26 17:08:18 -04:00
Mark Mentovai
0cc86a24f9 Add ScopedForbidReturn and its test.
Use ScopedForbidReturn in ProcessReader::InitializeThreads().

TEST=util_test ScopedForbidReturn*.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/493203005
2014-08-26 16:50:08 -04:00
Mark Mentovai
8256f9fc23 Add most of ProcessReader and its test.
TEST=util_test ProcessReader.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/491963002
2014-08-25 17:51:09 -04:00
Mark Mentovai
bbe4d85935 Add MachMultiprocess and its test.
TEST=util_test MachMultiprocess.MachMultiprocess
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/482483002
2014-08-20 13:58:42 -04:00
Mark Mentovai
280c4345c5 Add BootstrapCheckIn and its test.
TEST=util_test Bootstrap.BootstrapCheckIn
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/478713003
2014-08-18 20:41:00 -07:00
Mark Mentovai
8fe32b7b9c Add mac_util, including MacOSXMinorVersion(), MacOSXVersion(), and
MacModelAndBoard(), along with their tests.

TEST=util_test MacUtil.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/473023002
2014-08-15 22:33:14 -07:00
Mark Mentovai
a70edb3b7f Add ServiceManagement*() and their tests.
TEST=util_test ServiceManagement
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/467923003
2014-08-15 22:30:24 -07:00
Mark Mentovai
d05166c26c Add CheckedRange<> and its test.
TEST=util_test CheckedRange
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/467113002
2014-08-15 10:22:37 -07:00
Mark Mentovai
6997418cd4 Add InRangeCast<> and its test.
InRangeCast<> is similar to base::saturated_cast<>, but it allows the
caller to specify the value to be returned in the event that the source
value can’t be converted to the destination data type without data loss.

TEST=util_test InRangeCast
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/467103002
2014-08-14 16:00:44 -07:00
Mark Mentovai
5f554ff10e Add ProcessArgumentsForPID() (process_util) and its test.
TEST=util_test ProcessUtil.ProcessArgumentsForPID
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/461253002
2014-08-14 09:57:19 -07:00
Mark Mentovai
21af173940 Add InitializationStateDcheck, its base class, and their tests.
TEST=util_test InitializationState*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/465103002
2014-08-14 09:51:26 -07:00
Mark Mentovai
7090b209ad Use the gtest_main target for test executables.
There’s no need to build a separate copy of gtest_main.cc for each test
executable.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/465363004
2014-08-13 15:28:59 -07:00
Mark Mentovai
293964f69b Add CFPropertyToLaunchData() and its test.
TEST=util_test Launchd
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/438673003
2014-08-03 18:53:10 -04:00
Mark Mentovai
9f6d86742d Add TaskMemory, which can read another Mach task’s memory, and its test.
This also adds MachErrorMessage(), a test-only function that’s a
dependency of TaskMemory’s test, and related test-only error message
functions.

TEST=util_test TaskMemory.*
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/438993002
2014-08-03 18:48:40 -04:00
Mark Mentovai
4d6b867a1f Add UUID, c16lcpy (strlcpy for char16*), and their tests to util.
These are dependencies of the upcoming MinidumpStringWriter.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/430003003
2014-08-01 14:39:55 -04:00
Mark Mentovai
995012534e Introduce MinidumpWritable, its dependencies, and their tests.
MinidumpWritable is the base class for all minidump-writing operations.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/432003005
2014-08-01 12:48:28 -04:00