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 "ui/views/controls/menu/menu_runner.h" | 5 #include "ui/views/controls/menu/menu_runner.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "ui/views/widget/native_widget_private.h" | 26 #include "ui/views/widget/native_widget_private.h" |
27 #include "ui/views/widget/widget.h" | 27 #include "ui/views/widget/widget.h" |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 // Accepts a MenuRunnerImpl to release when this is. Simulates shutdown | 31 // Accepts a MenuRunnerImpl to release when this is. Simulates shutdown |
32 // occurring immediately during the release of ViewsDelegate. | 32 // occurring immediately during the release of ViewsDelegate. |
33 class DeletingTestViewsDelegate : public views::TestViewsDelegate { | 33 class DeletingTestViewsDelegate : public views::TestViewsDelegate { |
34 public: | 34 public: |
35 DeletingTestViewsDelegate() : menu_runner_(nullptr) {} | 35 DeletingTestViewsDelegate() : menu_runner_(nullptr) {} |
36 ~DeletingTestViewsDelegate() override{}; | 36 ~DeletingTestViewsDelegate() override {} |
37 | 37 |
38 void set_menu_runner(views::internal::MenuRunnerImpl* menu_runner) { | 38 void set_menu_runner(views::internal::MenuRunnerImpl* menu_runner) { |
39 menu_runner_ = menu_runner; | 39 menu_runner_ = menu_runner; |
40 } | 40 } |
41 | 41 |
42 // views::ViewsDelegate: | 42 // views::ViewsDelegate: |
43 void ReleaseRef() override; | 43 void ReleaseRef() override; |
44 | 44 |
45 private: | 45 private: |
46 // Not owned, deletes itself. | 46 // Not owned, deletes itself. |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 // This will release the ref on ViewsDelegate. The test version will release | 482 // This will release the ref on ViewsDelegate. The test version will release |
483 // |menu_runner| simulating device shutdown. | 483 // |menu_runner| simulating device shutdown. |
484 menu_controller.controller()->CancelAll(); | 484 menu_controller.controller()->CancelAll(); |
485 // Both the |menu_runner| and |menu_controller| should have been deleted. | 485 // Both the |menu_runner| and |menu_controller| should have been deleted. |
486 EXPECT_EQ(nullptr, ref); | 486 EXPECT_EQ(nullptr, ref); |
487 EXPECT_EQ(nullptr, menu_controller.controller()); | 487 EXPECT_EQ(nullptr, menu_controller.controller()); |
488 } | 488 } |
489 | 489 |
490 } // namespace test | 490 } // namespace test |
491 } // namespace views | 491 } // namespace views |
OLD | NEW |