| Index: util/test/thread_posix.cc
|
| diff --git a/util/win/time_test.cc b/util/test/thread_posix.cc
|
| similarity index 55%
|
| copy from util/win/time_test.cc
|
| copy to util/test/thread_posix.cc
|
| index ad0771e38b7889ab92154490845a0c3aafe13782..3a908845c925d0105b39375e949defd9ea767e29 100644
|
| --- a/util/win/time_test.cc
|
| +++ b/util/test/thread_posix.cc
|
| @@ -12,23 +12,33 @@
|
| // See the License for the specific language governing permissions and
|
| // limitations under the License.
|
|
|
| -#include "util/win/time.h"
|
| +#include "util/test/thread.h"
|
|
|
| #include "gtest/gtest.h"
|
| +#include "util/test/errors.h"
|
|
|
| namespace crashpad {
|
| namespace test {
|
| -namespace {
|
|
|
| -TEST(Time, Reasonable) {
|
| - timeval t;
|
| - GetTimeOfDay(&t);
|
| - // Assume that time's time_t return is seconds from 1970.
|
| - time_t approx_now = time(nullptr);
|
| - EXPECT_GE(approx_now, t.tv_sec);
|
| - EXPECT_LT(approx_now - 100, t.tv_sec);
|
| +void Thread::Start() {
|
| + ASSERT_FALSE(platform_thread_);
|
| + int rv = pthread_create(&platform_thread_, nullptr, ThreadEntryThunk, this);
|
| + ASSERT_EQ(0, rv) << ErrnoMessage(rv, "pthread_create");
|
| +}
|
| +
|
| +void Thread::Join() {
|
| + ASSERT_TRUE(platform_thread_);
|
| + int rv = pthread_join(platform_thread_, nullptr);
|
| + EXPECT_EQ(0, rv) << ErrnoMessage(rv, "pthread_join");
|
| + platform_thread_ = 0;
|
| +}
|
| +
|
| +// static
|
| +void* Thread::ThreadEntryThunk(void* argument) {
|
| + Thread* self = reinterpret_cast<Thread*>(argument);
|
| + self->ThreadMain();
|
| + return nullptr;
|
| }
|
|
|
| -} // namespace
|
| } // namespace test
|
| } // namespace crashpad
|
|
|