Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(999)

Side by Side Diff: base/message_loop/message_loop_unittest.cc

Issue 1559353002: base: Fix DCHECK when thread creation fails (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweak assert. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/message_loop/message_loop.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 scoped_refptr<SingleThreadTaskRunner> original_runner(loop.task_runner()); 1034 scoped_refptr<SingleThreadTaskRunner> original_runner(loop.task_runner());
1035 loop.SetTaskRunner(new_runner); 1035 loop.SetTaskRunner(new_runner);
1036 1036
1037 scoped_refptr<Foo> foo(new Foo()); 1037 scoped_refptr<Foo> foo(new Foo());
1038 original_runner->PostTask(FROM_HERE, 1038 original_runner->PostTask(FROM_HERE,
1039 Bind(&Foo::Test1ConstRef, foo.get(), "a")); 1039 Bind(&Foo::Test1ConstRef, foo.get(), "a"));
1040 loop.RunUntilIdle(); 1040 loop.RunUntilIdle();
1041 EXPECT_EQ(1, foo->test_count()); 1041 EXPECT_EQ(1, foo->test_count());
1042 } 1042 }
1043 1043
1044 TEST(MessageLoopTest, DeleteUnboundLoop) {
1045 // It should be possible to delete an unbound message loop on a thread which
1046 // already has another active loop. This happens when thread creation fails.
1047 MessageLoop loop;
1048 scoped_ptr<MessageLoop> unbound_loop(MessageLoop::CreateUnbound(
1049 MessageLoop::TYPE_DEFAULT, MessageLoop::MessagePumpFactoryCallback()));
1050 unbound_loop.reset();
1051 EXPECT_EQ(&loop, MessageLoop::current());
1052 EXPECT_EQ(loop.task_runner(), ThreadTaskRunnerHandle::Get());
1053 }
1054
1044 } // namespace base 1055 } // namespace base
OLDNEW
« no previous file with comments | « base/message_loop/message_loop.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698