| Index: ash/shelf/shelf_view_unittest.cc
|
| diff --git a/ash/shelf/shelf_view_unittest.cc b/ash/shelf/shelf_view_unittest.cc
|
| index c8fee6f6cd34ad1e6495415a42adfc26edb2ee23..eae4cfac212f1bcd386dfcf02a9b9c4ff9d62f49 100644
|
| --- a/ash/shelf/shelf_view_unittest.cc
|
| +++ b/ash/shelf/shelf_view_unittest.cc
|
| @@ -285,7 +285,11 @@ class TestShelfDelegateForShelfView : public ShelfDelegate {
|
|
|
| class ShelfViewTest : public AshTestBase {
|
| public:
|
| - ShelfViewTest() : model_(NULL), shelf_view_(NULL), browser_index_(1) {}
|
| + ShelfViewTest()
|
| + : model_(NULL),
|
| + shelf_view_(NULL),
|
| + browser_index_(1),
|
| + item_manager_(NULL) {}
|
| virtual ~ShelfViewTest() {}
|
|
|
| virtual void SetUp() OVERRIDE {
|
| @@ -419,10 +423,10 @@ class ShelfViewTest : public AshTestBase {
|
| }
|
| }
|
|
|
| - views::View* SimulateButtonPressed(ShelfButtonHost::Pointer pointer,
|
| + ShelfButton* SimulateButtonPressed(ShelfButtonHost::Pointer pointer,
|
| int button_index) {
|
| ShelfButtonHost* button_host = shelf_view_;
|
| - views::View* button = test_api_->GetButton(button_index);
|
| + ShelfButton* button = test_api_->GetButton(button_index);
|
| ui::MouseEvent click_event(ui::ET_MOUSE_PRESSED,
|
| gfx::Point(),
|
| button->GetBoundsInScreen().origin(), 0, 0);
|
| @@ -433,7 +437,13 @@ class ShelfViewTest : public AshTestBase {
|
| views::View* SimulateClick(ShelfButtonHost::Pointer pointer,
|
| int button_index) {
|
| ShelfButtonHost* button_host = shelf_view_;
|
| - views::View* button = SimulateButtonPressed(pointer, button_index);
|
| + ShelfButton* button = SimulateButtonPressed(pointer, button_index);
|
| + ui::MouseEvent release_event(ui::ET_MOUSE_RELEASED,
|
| + gfx::Point(),
|
| + button->GetBoundsInScreen().origin(),
|
| + 0,
|
| + 0);
|
| + test_api_->ButtonPressed(button, release_event);
|
| button_host->PointerReleasedOnButton(button, ShelfButtonHost::MOUSE, false);
|
| return button;
|
| }
|
| @@ -1057,6 +1067,19 @@ TEST_F(ShelfViewTest, ClickOneDragAnother) {
|
| EXPECT_TRUE(model_->items()[3].type == TYPE_BROWSER_SHORTCUT);
|
| }
|
|
|
| +// Tests that clicking on the browser item cleans up the menu model.
|
| +TEST_F(ShelfViewTest, ClickingBrowserIconCleansUpMenuModel) {
|
| + // Menu starts invisible.
|
| + ASSERT_FALSE(shelf_view_->IsShowingMenu());
|
| +
|
| + // Clicking the browser icon doesn't show one (the menu is too short).
|
| + SimulateClick(ShelfButtonHost::MOUSE, browser_index_);
|
| + EXPECT_FALSE(shelf_view_->IsShowingMenu());
|
| +
|
| + // No menu model, since no menu is showing.
|
| + EXPECT_FALSE(shelf_view_->list_menu_model_for_test());
|
| +}
|
| +
|
| // Check that clicking an item and jittering the mouse a bit still selects the
|
| // item.
|
| TEST_F(ShelfViewTest, ClickAndMoveSlightly) {
|
|
|