| 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/test/menu_test_utils.h" | 5 #include "ui/views/test/menu_test_utils.h" |
| 6 | 6 |
| 7 #include "ui/views/controls/menu/menu_controller.h" | 7 #include "ui/views/controls/menu/menu_controller.h" |
| 8 | 8 |
| 9 namespace views { | 9 namespace views { |
| 10 namespace test { | 10 namespace test { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 int TestMenuDelegate::GetDragOperations(MenuItemView* sender) { | 41 int TestMenuDelegate::GetDragOperations(MenuItemView* sender) { |
| 42 return ui::DragDropTypes::DRAG_COPY; | 42 return ui::DragDropTypes::DRAG_COPY; |
| 43 } | 43 } |
| 44 | 44 |
| 45 void TestMenuDelegate::WriteDragData(MenuItemView* sender, | 45 void TestMenuDelegate::WriteDragData(MenuItemView* sender, |
| 46 OSExchangeData* data) {} | 46 OSExchangeData* data) {} |
| 47 | 47 |
| 48 // MenuControllerTestApi ------------------------------------------------------ | 48 // MenuControllerTestApi ------------------------------------------------------ |
| 49 | 49 |
| 50 MenuControllerTestApi::MenuControllerTestApi() {} | 50 MenuControllerTestApi::MenuControllerTestApi() |
| 51 : controller_(MenuController::GetActiveInstance()->AsWeakPtr()) {} |
| 51 | 52 |
| 52 MenuControllerTestApi::~MenuControllerTestApi() {} | 53 MenuControllerTestApi::~MenuControllerTestApi() {} |
| 53 | 54 |
| 54 void MenuControllerTestApi::Hide() { | 55 void MenuControllerTestApi::ClearState() { |
| 55 MenuController* controller = MenuController::GetActiveInstance(); | 56 if (!controller_) |
| 56 if (!controller) | |
| 57 return; | 57 return; |
| 58 controller->showing_ = false; | 58 controller_->ClearStateForTest(); |
| 59 } |
| 60 |
| 61 void MenuControllerTestApi::SetShowing(bool showing) { |
| 62 if (!controller_) |
| 63 return; |
| 64 controller_->showing_ = showing; |
| 59 } | 65 } |
| 60 | 66 |
| 61 } // namespace test | 67 } // namespace test |
| 62 } // namespace views | 68 } // namespace views |
| OLD | NEW |