OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/common/worker_thread_ticker.h" | 5 #include "chrome/common/worker_thread_ticker.h" |
6 | 6 |
7 #include "base/logging.h" | |
8 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
9 #include "base/platform_thread.h" | 8 #include "base/platform_thread.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
11 | 10 |
12 namespace { | 11 namespace { |
13 | 12 |
14 class TestCallback : public WorkerThreadTicker::Callback { | 13 class TestCallback : public WorkerThreadTicker::Callback { |
15 public: | 14 public: |
16 TestCallback() : counter_(0), message_loop_(MessageLoop::current()) { | 15 TestCallback() : counter_(0), message_loop_(MessageLoop::current()) { |
17 } | 16 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 TEST(WorkerThreadTickerTest, LongCallback) { | 99 TEST(WorkerThreadTickerTest, LongCallback) { |
101 MessageLoop loop; | 100 MessageLoop loop; |
102 | 101 |
103 WorkerThreadTicker ticker(50); | 102 WorkerThreadTicker ticker(50); |
104 LongCallback callback; | 103 LongCallback callback; |
105 ASSERT_TRUE(ticker.RegisterTickHandler(&callback)); | 104 ASSERT_TRUE(ticker.RegisterTickHandler(&callback)); |
106 | 105 |
107 ASSERT_TRUE(ticker.Start()); | 106 ASSERT_TRUE(ticker.Start()); |
108 RunMessageLoopForAWhile(); | 107 RunMessageLoopForAWhile(); |
109 } | 108 } |
OLD | NEW |