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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 using base::Thread; | 26 using base::Thread; |
27 using base::Time; | 27 using base::Time; |
28 using base::TimeDelta; | 28 using base::TimeDelta; |
29 using base::TimeTicks; | 29 using base::TimeTicks; |
30 | 30 |
31 // TODO(darin): Platform-specific MessageLoop tests should be grouped together | 31 // TODO(darin): Platform-specific MessageLoop tests should be grouped together |
32 // to avoid chopping this file up with so many #ifdefs. | 32 // to avoid chopping this file up with so many #ifdefs. |
33 | 33 |
34 namespace { | 34 namespace { |
35 | 35 |
36 class MessageLoopTest : public testing::Test {}; | |
37 | |
38 class Foo : public base::RefCounted<Foo> { | 36 class Foo : public base::RefCounted<Foo> { |
39 public: | 37 public: |
40 Foo() : test_count_(0) { | 38 Foo() : test_count_(0) { |
41 } | 39 } |
42 | 40 |
43 void Test0() { | 41 void Test0() { |
44 ++test_count_; | 42 ++test_count_; |
45 } | 43 } |
46 | 44 |
47 void Test1ConstRef(const std::string& a) { | 45 void Test1ConstRef(const std::string& a) { |
(...skipping 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2054 EXPECT_EQ(foo->test_count(), 1); | 2052 EXPECT_EQ(foo->test_count(), 1); |
2055 EXPECT_EQ(foo->result(), "a"); | 2053 EXPECT_EQ(foo->result(), "a"); |
2056 } | 2054 } |
2057 | 2055 |
2058 TEST(MessageLoopTest, IsType) { | 2056 TEST(MessageLoopTest, IsType) { |
2059 MessageLoop loop(MessageLoop::TYPE_UI); | 2057 MessageLoop loop(MessageLoop::TYPE_UI); |
2060 EXPECT_TRUE(loop.IsType(MessageLoop::TYPE_UI)); | 2058 EXPECT_TRUE(loop.IsType(MessageLoop::TYPE_UI)); |
2061 EXPECT_FALSE(loop.IsType(MessageLoop::TYPE_IO)); | 2059 EXPECT_FALSE(loop.IsType(MessageLoop::TYPE_IO)); |
2062 EXPECT_FALSE(loop.IsType(MessageLoop::TYPE_DEFAULT)); | 2060 EXPECT_FALSE(loop.IsType(MessageLoop::TYPE_DEFAULT)); |
2063 } | 2061 } |
OLD | NEW |