Skip to content

Commit

Permalink
Add test of mouse-click to invoke home card.
Browse files Browse the repository at this point in the history
BUG=403813
TEST=athena_unittests
R=oshima@chromium.org

Review URL: https://codereview.chromium.org/496793004

Cr-Commit-Position: refs/heads/master@{#291311}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291311 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
mukai@chromium.org committed Aug 22, 2014
1 parent 699245a commit 3892fa4
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions athena/home/home_card_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "athena/activity/public/activity_manager.h"
#include "athena/test/athena_test_base.h"
#include "athena/wm/public/window_manager.h"
#include "ui/aura/window.h"
#include "ui/events/test/event_generator.h"

namespace athena {
Expand Down Expand Up @@ -82,4 +83,24 @@ TEST_F(HomeCardTest, Accelerators) {
EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState());
}

TEST_F(HomeCardTest, MouseClick) {
ASSERT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState());

// Mouse click at the bottom of the screen should invokes overview mode and
// changes the state to BOTTOM.
ui::test::EventGenerator generator(root_window());
gfx::Rect screen_rect(root_window()->bounds());
generator.MoveMouseTo(gfx::Point(
screen_rect.x() + screen_rect.width() / 2, screen_rect.bottom() - 1));
generator.ClickLeftButton();

EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState());
EXPECT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive());

// Further clicks are simply ignored.
generator.ClickLeftButton();
EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState());
EXPECT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive());
}

} // namespace athena

0 comments on commit 3892fa4

Please sign in to comment.