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/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/memory/singleton.h" | 6 #include "base/memory/singleton.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 CallbackFunc* GetStaticSingleton() { | 147 CallbackFunc* GetStaticSingleton() { |
148 return &CallbackSingletonWithStaticTrait::GetInstance()->callback_; | 148 return &CallbackSingletonWithStaticTrait::GetInstance()->callback_; |
149 } | 149 } |
150 | 150 |
151 } // namespace | 151 } // namespace |
152 | 152 |
153 class SingletonTest : public testing::Test { | 153 class SingletonTest : public testing::Test { |
154 public: | 154 public: |
155 SingletonTest() {} | 155 SingletonTest() {} |
156 | 156 |
157 virtual void SetUp() OVERRIDE { | 157 void SetUp() override { |
158 non_leak_called_ = false; | 158 non_leak_called_ = false; |
159 leaky_called_ = false; | 159 leaky_called_ = false; |
160 static_called_ = false; | 160 static_called_ = false; |
161 } | 161 } |
162 | 162 |
163 protected: | 163 protected: |
164 void VerifiesCallbacks() { | 164 void VerifiesCallbacks() { |
165 EXPECT_TRUE(non_leak_called_); | 165 EXPECT_TRUE(non_leak_called_); |
166 EXPECT_FALSE(leaky_called_); | 166 EXPECT_FALSE(leaky_called_); |
167 EXPECT_TRUE(static_called_); | 167 EXPECT_TRUE(static_called_); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 AlignedTestSingleton<AlignedMemory<128, 128> >* align128 = | 279 AlignedTestSingleton<AlignedMemory<128, 128> >* align128 = |
280 AlignedTestSingleton<AlignedMemory<128, 128> >::GetInstance(); | 280 AlignedTestSingleton<AlignedMemory<128, 128> >::GetInstance(); |
281 AlignedTestSingleton<AlignedMemory<4096, 4096> >* align4096 = | 281 AlignedTestSingleton<AlignedMemory<4096, 4096> >* align4096 = |
282 AlignedTestSingleton<AlignedMemory<4096, 4096> >::GetInstance(); | 282 AlignedTestSingleton<AlignedMemory<4096, 4096> >::GetInstance(); |
283 | 283 |
284 EXPECT_ALIGNED(align4, 4); | 284 EXPECT_ALIGNED(align4, 4); |
285 EXPECT_ALIGNED(align32, 32); | 285 EXPECT_ALIGNED(align32, 32); |
286 EXPECT_ALIGNED(align128, 128); | 286 EXPECT_ALIGNED(align128, 128); |
287 EXPECT_ALIGNED(align4096, 4096); | 287 EXPECT_ALIGNED(align4096, 4096); |
288 } | 288 } |
OLD | NEW |