Chromium Code Reviews| 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..377dc71ccf306ec379144d96d475793357ef572a 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() { |
| + EXPECT_FALSE(platform_thread_); |
|
Mark Mentovai
2015/03/20 22:11:37
ASSERT on this and the one at the top of Join(). S
scottmg
2015/03/20 22:32:53
Done.
|
| + int rv = pthread_create(&platform_thread_, nullptr, ThreadEntryThunk, this); |
| + ASSERT_EQ(0, rv) << ErrnoMessage(rv, "pthread_create"); |
| +} |
| + |
| +void Thread::Join() { |
| + EXPECT_TRUE(platform_thread_); |
| + int rv = pthread_join(platform_thread_, nullptr); |
| + ASSERT_EQ(0, rv) << ErrnoMessage(rv, "pthread_join"); |
|
Mark Mentovai
2015/03/20 22:11:37
EXPECT like you did in the _win.cc, so that you st
scottmg
2015/03/20 22:32:53
Done.
|
| + platform_thread_ = 0; |
| +} |
| + |
| +// static |
| +void* Thread::ThreadEntryThunk(void* argument) { |
| + Thread* self = reinterpret_cast<Thread*>(argument); |
| + self->Main(); |
| + return nullptr; |
| } |
| -} // namespace |
| } // namespace test |
| } // namespace crashpad |