| 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 virtual void Run(Delegate* delegate) override {} |
| 236 | 236 |
| 237 virtual void Quit() OVERRIDE {} | 237 virtual void Quit() override {} |
| 238 virtual void ScheduleWork() OVERRIDE {} | 238 virtual void ScheduleWork() override {} |
| 239 virtual void ScheduleDelayedWork( | 239 virtual void ScheduleDelayedWork( |
| 240 const TimeTicks& delayed_work_time) OVERRIDE {} | 240 const TimeTicks& delayed_work_time) override {} |
| 241 }; | 241 }; |
| 242 | 242 |
| 243 class PostTaskTest : public testing::Test { | 243 class PostTaskTest : public testing::Test { |
| 244 public: | 244 public: |
| 245 void Run(int batch_size, int tasks_per_reload) { | 245 void Run(int batch_size, int tasks_per_reload) { |
| 246 base::TimeTicks start = base::TimeTicks::HighResNow(); | 246 base::TimeTicks start = base::TimeTicks::HighResNow(); |
| 247 base::TimeTicks now; | 247 base::TimeTicks now; |
| 248 MessageLoop loop(scoped_ptr<MessagePump>(new FakeMessagePump)); | 248 MessageLoop loop(scoped_ptr<MessagePump>(new FakeMessagePump)); |
| 249 scoped_refptr<internal::IncomingTaskQueue> queue( | 249 scoped_refptr<internal::IncomingTaskQueue> queue( |
| 250 new internal::IncomingTaskQueue(&loop)); | 250 new internal::IncomingTaskQueue(&loop)); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 TEST_F(PostTaskTest, TenTasksPerReload) { | 285 TEST_F(PostTaskTest, TenTasksPerReload) { |
| 286 Run(10000, 10); | 286 Run(10000, 10); |
| 287 } | 287 } |
| 288 | 288 |
| 289 TEST_F(PostTaskTest, OneHundredTasksPerReload) { | 289 TEST_F(PostTaskTest, OneHundredTasksPerReload) { |
| 290 Run(1000, 100); | 290 Run(1000, 100); |
| 291 } | 291 } |
| 292 | 292 |
| 293 } // namespace | 293 } // namespace |
| 294 } // namespace base | 294 } // namespace base |
| OLD | NEW |