| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 7 #include "base/test/test_simple_task_runner.h" | 7 #include "base/test/test_simple_task_runner.h" |
| 8 #include "base/timer/timer.h" | 8 #include "base/timer/timer.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/googletest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 using base::TimeDelta; | 11 using base::TimeDelta; |
| 12 using base::SingleThreadTaskRunner; | 12 using base::SingleThreadTaskRunner; |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 // The message loops on which each timer should be tested. | 16 // The message loops on which each timer should be tested. |
| 17 const base::MessageLoop::Type testing_message_loops[] = { | 17 const base::MessageLoop::Type testing_message_loops[] = { |
| 18 base::MessageLoop::TYPE_DEFAULT, | 18 base::MessageLoop::TYPE_DEFAULT, |
| 19 base::MessageLoop::TYPE_IO, | 19 base::MessageLoop::TYPE_IO, |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 base::Bind(&SetCallbackHappened1)); | 522 base::Bind(&SetCallbackHappened1)); |
| 523 timer.Reset(); | 523 timer.Reset(); |
| 524 // Since Reset happened before task ran, the user_task must not be cleared: | 524 // Since Reset happened before task ran, the user_task must not be cleared: |
| 525 ASSERT_FALSE(timer.user_task().is_null()); | 525 ASSERT_FALSE(timer.user_task().is_null()); |
| 526 base::MessageLoop::current()->Run(); | 526 base::MessageLoop::current()->Run(); |
| 527 EXPECT_TRUE(g_callback_happened1); | 527 EXPECT_TRUE(g_callback_happened1); |
| 528 } | 528 } |
| 529 } | 529 } |
| 530 | 530 |
| 531 } // namespace | 531 } // namespace |
| OLD | NEW |