Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: ui/views/accessibility/ax_aura_obj_cache_unittest.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698