OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/threading/thread.h" | 5 #include "base/threading/thread.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 |
7 #include <vector> | 9 #include <vector> |
8 | 10 |
9 #include "base/bind.h" | 11 #include "base/bind.h" |
10 #include "base/location.h" | 12 #include "base/location.h" |
11 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
12 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
13 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 15 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| 16 #include "build/build_config.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "testing/platform_test.h" | 18 #include "testing/platform_test.h" |
16 | 19 |
17 using base::Thread; | 20 using base::Thread; |
18 | 21 |
19 typedef PlatformTest ThreadTest; | 22 typedef PlatformTest ThreadTest; |
20 | 23 |
21 namespace { | 24 namespace { |
22 | 25 |
23 void ToggleValue(bool* value) { | 26 void ToggleValue(bool* value) { |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 ASSERT_EQ(static_cast<size_t>(THREAD_NUM_EVENTS), captured_events.size()); | 286 ASSERT_EQ(static_cast<size_t>(THREAD_NUM_EVENTS), captured_events.size()); |
284 EXPECT_EQ(THREAD_EVENT_INIT, captured_events[0]); | 287 EXPECT_EQ(THREAD_EVENT_INIT, captured_events[0]); |
285 EXPECT_EQ(THREAD_EVENT_CLEANUP, captured_events[1]); | 288 EXPECT_EQ(THREAD_EVENT_CLEANUP, captured_events[1]); |
286 EXPECT_EQ(THREAD_EVENT_MESSAGE_LOOP_DESTROYED, captured_events[2]); | 289 EXPECT_EQ(THREAD_EVENT_MESSAGE_LOOP_DESTROYED, captured_events[2]); |
287 } | 290 } |
288 | 291 |
289 TEST_F(ThreadTest, ThreadNotStarted) { | 292 TEST_F(ThreadTest, ThreadNotStarted) { |
290 Thread a("Inert"); | 293 Thread a("Inert"); |
291 EXPECT_EQ(nullptr, a.task_runner()); | 294 EXPECT_EQ(nullptr, a.task_runner()); |
292 } | 295 } |
OLD | NEW |