| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_controller.h" | 5 #include "ui/views/controls/menu/menu_controller.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "ui/aura/scoped_window_targeter.h" | 8 #include "ui/aura/scoped_window_targeter.h" |
| 9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 10 #include "ui/events/event_handler.h" | 10 #include "ui/events/event_handler.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 207 |
| 208 void SetupMenuItem() { | 208 void SetupMenuItem() { |
| 209 menu_item_.reset(new TestMenuItemViewShown); | 209 menu_item_.reset(new TestMenuItemViewShown); |
| 210 menu_item_->AppendMenuItemWithLabel(1, base::ASCIIToUTF16("One")); | 210 menu_item_->AppendMenuItemWithLabel(1, base::ASCIIToUTF16("One")); |
| 211 menu_item_->AppendMenuItemWithLabel(2, base::ASCIIToUTF16("Two")); | 211 menu_item_->AppendMenuItemWithLabel(2, base::ASCIIToUTF16("Two")); |
| 212 menu_item_->AppendMenuItemWithLabel(3, base::ASCIIToUTF16("Three")); | 212 menu_item_->AppendMenuItemWithLabel(3, base::ASCIIToUTF16("Three")); |
| 213 menu_item_->AppendMenuItemWithLabel(4, base::ASCIIToUTF16("Four")); | 213 menu_item_->AppendMenuItemWithLabel(4, base::ASCIIToUTF16("Four")); |
| 214 } | 214 } |
| 215 | 215 |
| 216 void SetupMenuController() { | 216 void SetupMenuController() { |
| 217 menu_controller_= new MenuController(nullptr, true, nullptr); | 217 menu_controller_= new MenuController(true, nullptr); |
| 218 menu_controller_->owner_ = owner_.get(); | 218 menu_controller_->owner_ = owner_.get(); |
| 219 menu_controller_->showing_ = true; | 219 menu_controller_->showing_ = true; |
| 220 menu_controller_->SetSelection( | 220 menu_controller_->SetSelection( |
| 221 menu_item_.get(), MenuController::SELECTION_UPDATE_IMMEDIATELY); | 221 menu_item_.get(), MenuController::SELECTION_UPDATE_IMMEDIATELY); |
| 222 } | 222 } |
| 223 | 223 |
| 224 scoped_ptr<Widget> owner_; | 224 scoped_ptr<Widget> owner_; |
| 225 scoped_ptr<ui::test::EventGenerator> event_generator_; | 225 scoped_ptr<ui::test::EventGenerator> event_generator_; |
| 226 scoped_ptr<TestMenuItemViewShown> menu_item_; | 226 scoped_ptr<TestMenuItemViewShown> menu_item_; |
| 227 MenuController* menu_controller_; | 227 MenuController* menu_controller_; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 // Move up and select a previous (in our case the last enabled) item. | 411 // Move up and select a previous (in our case the last enabled) item. |
| 412 DecrementSelection(); | 412 DecrementSelection(); |
| 413 EXPECT_EQ(3, pending_state_item()->GetCommand()); | 413 EXPECT_EQ(3, pending_state_item()->GetCommand()); |
| 414 | 414 |
| 415 // Clear references in menu controller to the menu item that is going away. | 415 // Clear references in menu controller to the menu item that is going away. |
| 416 ResetSelection(); | 416 ResetSelection(); |
| 417 } | 417 } |
| 418 | 418 |
| 419 } // namespace test | 419 } // namespace test |
| 420 } // namespace views | 420 } // namespace views |
| OLD | NEW |