Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: athena/home/home_card_unittest.cc

Issue 601333002: ESC accelerator and consistent overview mode for Athena homecard (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « athena/home/home_card_impl.cc ('k') | athena/input/accelerator_manager_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "athena/home/public/home_card.h" 5 #include "athena/home/public/home_card.h"
6 6
7 #include "athena/activity/public/activity_factory.h" 7 #include "athena/activity/public/activity_factory.h"
8 #include "athena/home/home_card_constants.h" 8 #include "athena/home/home_card_constants.h"
9 #include "athena/home/home_card_impl.h" 9 #include "athena/home/home_card_impl.h"
10 #include "athena/test/base/athena_test_base.h" 10 #include "athena/test/base/athena_test_base.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 athena::ActivityFactory::Get()->CreateWebActivity( 109 athena::ActivityFactory::Get()->CreateWebActivity(
110 NULL, base::string16(), GURL("http://www.google.com/")); 110 NULL, base::string16(), GURL("http://www.google.com/"));
111 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); 111 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState());
112 } 112 }
113 113
114 TEST_F(HomeCardTest, Accelerators) { 114 TEST_F(HomeCardTest, Accelerators) {
115 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); 115 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState());
116 116
117 ui::test::EventGenerator generator(root_window()); 117 ui::test::EventGenerator generator(root_window());
118
119 // CTRL+L toggles centered home card, check that overview mode follows
118 generator.PressKey(ui::VKEY_L, ui::EF_CONTROL_DOWN); 120 generator.PressKey(ui::VKEY_L, ui::EF_CONTROL_DOWN);
119 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); 121 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState());
120 122 EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive());
121 generator.PressKey(ui::VKEY_L, ui::EF_CONTROL_DOWN); 123 generator.PressKey(ui::VKEY_L, ui::EF_CONTROL_DOWN);
122 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); 124 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState());
125 EXPECT_FALSE(WindowManager::Get()->IsOverviewModeActive());
123 126
124 // Do nothing for BOTTOM 127 // ESC key hides centered home card
128 generator.PressKey(ui::VKEY_L, ui::EF_CONTROL_DOWN);
129 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState());
130 EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive());
131 generator.PressKey(ui::VKEY_ESCAPE, ui::EF_NONE);
132 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState());
133 EXPECT_FALSE(WindowManager::Get()->IsOverviewModeActive());
134
135 // Do nothing with bottom home card with CTRL+L, hide with ESC key
125 WindowManager::Get()->EnterOverview(); 136 WindowManager::Get()->EnterOverview();
126 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); 137 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState());
138 EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive());
127 generator.PressKey(ui::VKEY_L, ui::EF_CONTROL_DOWN); 139 generator.PressKey(ui::VKEY_L, ui::EF_CONTROL_DOWN);
128 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); 140 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState());
141 EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive());
142 generator.PressKey(ui::VKEY_ESCAPE, ui::EF_NONE);
143 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState());
144 EXPECT_FALSE(WindowManager::Get()->IsOverviewModeActive());
129 145
130 // Do nothing if the centered state is a temporary state. 146 // Do nothing if the centered state is a temporary state.
147 WindowManager::Get()->EnterOverview();
148 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState());
149 EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive());
131 HomeCard::Get()->UpdateVirtualKeyboardBounds(gfx::Rect(0, 0, 100, 100)); 150 HomeCard::Get()->UpdateVirtualKeyboardBounds(gfx::Rect(0, 0, 100, 100));
132 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); 151 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState());
152 EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive());
133 generator.PressKey(ui::VKEY_L, ui::EF_CONTROL_DOWN); 153 generator.PressKey(ui::VKEY_L, ui::EF_CONTROL_DOWN);
134 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); 154 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState());
155 EXPECT_TRUE(WindowManager::Get()->IsOverviewModeActive());
135 } 156 }
136 157
137 TEST_F(HomeCardTest, MouseClick) { 158 TEST_F(HomeCardTest, MouseClick) {
138 ASSERT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); 159 ASSERT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState());
139 160
140 // Mouse click at the bottom of the screen should invokes overview mode and 161 // Mouse click at the bottom of the screen should invokes overview mode and
141 // changes the state to BOTTOM. 162 // changes the state to BOTTOM.
142 gfx::Rect screen_rect(root_window()->bounds()); 163 gfx::Rect screen_rect(root_window()->bounds());
143 ui::test::EventGenerator generator( 164 ui::test::EventGenerator generator(
144 root_window(), gfx::Point( 165 root_window(), gfx::Point(
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 292
272 generator.GestureScrollSequence(gfx::Point(x, 10), 293 generator.GestureScrollSequence(gfx::Point(x, 10),
273 gfx::Point(x, bottom - 100), 294 gfx::Point(x, bottom - 100),
274 base::TimeDelta::FromSeconds(1), 295 base::TimeDelta::FromSeconds(1),
275 10); 296 10);
276 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState()); 297 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState());
277 EXPECT_FALSE(IsSearchBoxFocused(home_card)); 298 EXPECT_FALSE(IsSearchBoxFocused(home_card));
278 } 299 }
279 300
280 } // namespace athena 301 } // namespace athena
OLDNEW
« no previous file with comments | « athena/home/home_card_impl.cc ('k') | athena/input/accelerator_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698