| OLD | NEW | 
|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 5 #include <stddef.h> | 
| 6 #include <stdint.h> | 6 #include <stdint.h> | 
| 7 | 7 | 
| 8 #include <vector> | 8 #include <vector> | 
| 9 | 9 | 
| 10 #include "base/bind.h" | 10 #include "base/bind.h" | 
| (...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 972   // It should be possible to delete an unbound message loop on a thread which | 972   // It should be possible to delete an unbound message loop on a thread which | 
| 973   // already has another active loop. This happens when thread creation fails. | 973   // already has another active loop. This happens when thread creation fails. | 
| 974   MessageLoop loop; | 974   MessageLoop loop; | 
| 975   std::unique_ptr<MessageLoop> unbound_loop(MessageLoop::CreateUnbound( | 975   std::unique_ptr<MessageLoop> unbound_loop(MessageLoop::CreateUnbound( | 
| 976       MessageLoop::TYPE_DEFAULT, MessageLoop::MessagePumpFactoryCallback())); | 976       MessageLoop::TYPE_DEFAULT, MessageLoop::MessagePumpFactoryCallback())); | 
| 977   unbound_loop.reset(); | 977   unbound_loop.reset(); | 
| 978   EXPECT_EQ(&loop, MessageLoop::current()); | 978   EXPECT_EQ(&loop, MessageLoop::current()); | 
| 979   EXPECT_EQ(loop.task_runner(), ThreadTaskRunnerHandle::Get()); | 979   EXPECT_EQ(loop.task_runner(), ThreadTaskRunnerHandle::Get()); | 
| 980 } | 980 } | 
| 981 | 981 | 
|  | 982 TEST(MessageLoopTest, ThreadName) { | 
|  | 983   { | 
|  | 984     std::string kThreadName("foo"); | 
|  | 985     MessageLoop loop; | 
|  | 986     PlatformThread::SetName(kThreadName); | 
|  | 987     EXPECT_EQ(kThreadName, loop.GetThreadName()); | 
|  | 988   } | 
|  | 989 | 
|  | 990   { | 
|  | 991     std::string kThreadName("bar"); | 
|  | 992     base::Thread thread(kThreadName); | 
|  | 993     ASSERT_TRUE(thread.StartAndWaitForTesting()); | 
|  | 994     EXPECT_EQ(kThreadName, thread.message_loop()->GetThreadName()); | 
|  | 995   } | 
|  | 996 } | 
|  | 997 | 
| 982 }  // namespace base | 998 }  // namespace base | 
| OLD | NEW | 
|---|