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

Side by Side Diff: base/deferred_sequenced_task_runner_unittest.cc

Issue 16092013: Use base::MessageLoop in more files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again, sigh Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « ash/test/ash_test_helper.cc ('k') | base/hi_res_timer_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "base/deferred_sequenced_task_runner.h" 5 #include "base/deferred_sequenced_task_runner.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 void DoNothing(ExecuteTaskOnDestructor* object) { 57 void DoNothing(ExecuteTaskOnDestructor* object) {
58 } 58 }
59 59
60 protected: 60 protected:
61 DeferredSequencedTaskRunnerTest() : 61 DeferredSequencedTaskRunnerTest() :
62 loop_(), 62 loop_(),
63 runner_( 63 runner_(
64 new base::DeferredSequencedTaskRunner(loop_.message_loop_proxy())) { 64 new base::DeferredSequencedTaskRunner(loop_.message_loop_proxy())) {
65 } 65 }
66 66
67 MessageLoop loop_; 67 base::MessageLoop loop_;
68 scoped_refptr<base::DeferredSequencedTaskRunner> runner_; 68 scoped_refptr<base::DeferredSequencedTaskRunner> runner_;
69 mutable base::Lock lock_; 69 mutable base::Lock lock_;
70 std::vector<int> executed_task_ids_; 70 std::vector<int> executed_task_ids_;
71 }; 71 };
72 72
73 TEST_F(DeferredSequencedTaskRunnerTest, Stopped) { 73 TEST_F(DeferredSequencedTaskRunnerTest, Stopped) {
74 PostExecuteTask(1); 74 PostExecuteTask(1);
75 loop_.RunUntilIdle(); 75 loop_.RunUntilIdle();
76 EXPECT_THAT(executed_task_ids_, testing::ElementsAre()); 76 EXPECT_THAT(executed_task_ids_, testing::ElementsAre());
77 } 77 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 StartRunner(); 175 StartRunner();
176 } 176 }
177 177
178 // All |short_lived_object| with id |2 * i| are destroyed before the task 178 // All |short_lived_object| with id |2 * i| are destroyed before the task
179 // |2 * i + 1| is executed. 179 // |2 * i + 1| is executed.
180 EXPECT_THAT(executed_task_ids_, 180 EXPECT_THAT(executed_task_ids_,
181 testing::ElementsAre(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)); 181 testing::ElementsAre(0, 1, 2, 3, 4, 5, 6, 7, 8, 9));
182 } 182 }
183 183
184 } // namespace 184 } // namespace
OLDNEW
« no previous file with comments | « ash/test/ash_test_helper.cc ('k') | base/hi_res_timer_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698