OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/format_macros.h" | 6 #include "base/format_macros.h" |
7 #include "base/memory/scoped_vector.h" | 7 #include "base/memory/scoped_vector.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/synchronization/condition_variable.h" | 9 #include "base/synchronization/condition_variable.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 #endif | 225 #endif |
226 | 226 |
227 static void DoNothing() { | 227 static void DoNothing() { |
228 } | 228 } |
229 | 229 |
230 class FakeMessagePump : public MessagePump { | 230 class FakeMessagePump : public MessagePump { |
231 public: | 231 public: |
232 FakeMessagePump() {} | 232 FakeMessagePump() {} |
233 virtual ~FakeMessagePump() {} | 233 virtual ~FakeMessagePump() {} |
234 | 234 |
235 virtual void Run(Delegate* delegate) OVERRIDE {} | 235 void Run(Delegate* delegate) override {} |
236 | 236 |
237 virtual void Quit() OVERRIDE {} | 237 void Quit() override {} |
238 virtual void ScheduleWork() OVERRIDE {} | 238 void ScheduleWork() override {} |
239 virtual void ScheduleDelayedWork( | 239 void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override {} |
240 const TimeTicks& delayed_work_time) OVERRIDE {} | |
241 }; | 240 }; |
242 | 241 |
243 class PostTaskTest : public testing::Test { | 242 class PostTaskTest : public testing::Test { |
244 public: | 243 public: |
245 void Run(int batch_size, int tasks_per_reload) { | 244 void Run(int batch_size, int tasks_per_reload) { |
246 base::TimeTicks start = base::TimeTicks::HighResNow(); | 245 base::TimeTicks start = base::TimeTicks::HighResNow(); |
247 base::TimeTicks now; | 246 base::TimeTicks now; |
248 MessageLoop loop(scoped_ptr<MessagePump>(new FakeMessagePump)); | 247 MessageLoop loop(scoped_ptr<MessagePump>(new FakeMessagePump)); |
249 scoped_refptr<internal::IncomingTaskQueue> queue( | 248 scoped_refptr<internal::IncomingTaskQueue> queue( |
250 new internal::IncomingTaskQueue(&loop)); | 249 new internal::IncomingTaskQueue(&loop)); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 TEST_F(PostTaskTest, TenTasksPerReload) { | 284 TEST_F(PostTaskTest, TenTasksPerReload) { |
286 Run(10000, 10); | 285 Run(10000, 10); |
287 } | 286 } |
288 | 287 |
289 TEST_F(PostTaskTest, OneHundredTasksPerReload) { | 288 TEST_F(PostTaskTest, OneHundredTasksPerReload) { |
290 Run(1000, 100); | 289 Run(1000, 100); |
291 } | 290 } |
292 | 291 |
293 } // namespace | 292 } // namespace |
294 } // namespace base | 293 } // namespace base |
OLD | NEW |