| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "cc/base/sidecar_list_container.h" | 5 #include "cc/base/sidecar_list_container.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 num_elements++; | 175 num_elements++; |
| 176 } | 176 } |
| 177 EXPECT_EQ(kNumElementsForTest, num_elements); | 177 EXPECT_EQ(kNumElementsForTest, num_elements); |
| 178 | 178 |
| 179 container.clear(); | 179 container.clear(); |
| 180 EXPECT_TRUE(container.empty()); | 180 EXPECT_TRUE(container.empty()); |
| 181 EXPECT_EQ(0u, container.size()); | 181 EXPECT_EQ(0u, container.size()); |
| 182 EXPECT_EQ(container.end(), container.begin()); | 182 EXPECT_EQ(container.end(), container.begin()); |
| 183 } | 183 } |
| 184 | 184 |
| 185 TEST(SidecarListContainerTest, RemoveLast) { |
| 186 // We need only ensure that the sidecar is also destroyed on RemoveLast. |
| 187 // The rest is logic already present in ListContainer. |
| 188 bool sidecar_destroyed = false; |
| 189 TestContainer container; |
| 190 TestElement* element = container.AllocateAndConstruct<TestElement>(); |
| 191 new (container.GetSidecar(element)) TestSidecar(&sidecar_destroyed); |
| 192 ASSERT_FALSE(sidecar_destroyed); |
| 193 container.RemoveLast(); |
| 194 ASSERT_TRUE(sidecar_destroyed); |
| 195 } |
| 196 |
| 185 } // namespace | 197 } // namespace |
| 186 } // namespace cc | 198 } // namespace cc |
| OLD | NEW |