OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ui/views/accessibility/ax_aura_obj_cache.h" | 5 #include "ui/views/accessibility/ax_aura_obj_cache.h" |
6 #include "ui/views/test/widget_test.h" | 6 #include "ui/views/test/widget_test.h" |
7 | 7 |
8 namespace views { | 8 namespace views { |
9 namespace test { | 9 namespace test { |
10 | 10 |
11 namespace { | 11 namespace { |
12 | 12 |
13 // This class can be used as a deleter for scoped_ptr<Widget> | 13 // This class can be used as a deleter for std::unique_ptr<Widget> |
14 // to call function Widget::CloseNow automatically. | 14 // to call function Widget::CloseNow automatically. |
15 struct WidgetCloser { | 15 struct WidgetCloser { |
16 inline void operator()(Widget* widget) const { widget->CloseNow(); } | 16 inline void operator()(Widget* widget) const { widget->CloseNow(); } |
17 }; | 17 }; |
18 | 18 |
19 using WidgetAutoclosePtr = scoped_ptr<Widget, WidgetCloser>; | 19 using WidgetAutoclosePtr = std::unique_ptr<Widget, WidgetCloser>; |
20 } | 20 } |
21 | 21 |
22 class AXAuraObjCacheTest : public WidgetTest { | 22 class AXAuraObjCacheTest : public WidgetTest { |
23 public: | 23 public: |
24 AXAuraObjCacheTest() {} | 24 AXAuraObjCacheTest() {} |
25 ~AXAuraObjCacheTest() override {} | 25 ~AXAuraObjCacheTest() override {} |
26 }; | 26 }; |
27 | 27 |
28 TEST_F(AXAuraObjCacheTest, TestViewRemoval) { | 28 TEST_F(AXAuraObjCacheTest, TestViewRemoval) { |
29 WidgetAutoclosePtr widget(CreateTopLevelPlatformWidget()); | 29 WidgetAutoclosePtr widget(CreateTopLevelPlatformWidget()); |
(...skipping 22 matching lines...) Expand all Loading... |
52 ASSERT_EQ(-1, cache->GetID(parent)); | 52 ASSERT_EQ(-1, cache->GetID(parent)); |
53 ASSERT_EQ(-1, cache->GetID(child)); | 53 ASSERT_EQ(-1, cache->GetID(child)); |
54 | 54 |
55 // Explicitly delete |parent| to prevent a memory leak, since calling | 55 // Explicitly delete |parent| to prevent a memory leak, since calling |
56 // RemoveChildView() doesn't delete it. | 56 // RemoveChildView() doesn't delete it. |
57 delete parent; | 57 delete parent; |
58 } | 58 } |
59 | 59 |
60 } // namespace test | 60 } // namespace test |
61 } // namespace views | 61 } // namespace views |
OLD | NEW |