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

Side by Side Diff: ash/shelf/shelf_tooltip_manager_unittest.cc

Issue 2815043002: Removes ShellPort::IsRunningInMash() (Closed)
Patch Set: dont set instance_ in constructor Created 3 years, 8 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 | « ash/shelf/shelf_layout_manager_unittest.cc ('k') | ash/shelf/shelf_view_unittest.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ash/shelf/shelf_tooltip_manager.h" 5 #include "ash/shelf/shelf_tooltip_manager.h"
6 6
7 #include "ash/public/cpp/config.h"
7 #include "ash/shelf/app_list_button.h" 8 #include "ash/shelf/app_list_button.h"
8 #include "ash/shelf/shelf_model.h" 9 #include "ash/shelf/shelf_model.h"
9 #include "ash/shelf/shelf_view.h" 10 #include "ash/shelf/shelf_view.h"
10 #include "ash/shelf/wm_shelf.h" 11 #include "ash/shelf/wm_shelf.h"
11 #include "ash/shell_port.h" 12 #include "ash/shell.h"
12 #include "ash/test/ash_test_base.h" 13 #include "ash/test/ash_test_base.h"
13 #include "ash/test/shelf_view_test_api.h" 14 #include "ash/test/shelf_view_test_api.h"
14 #include "ash/test/test_shelf_item_delegate.h" 15 #include "ash/test/test_shelf_item_delegate.h"
15 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
16 #include "ui/events/event_constants.h" 17 #include "ui/events/event_constants.h"
17 #include "ui/events/test/event_generator.h" 18 #include "ui/events/test/event_generator.h"
18 #include "ui/views/bubble/bubble_dialog_delegate.h" 19 #include "ui/views/bubble/bubble_dialog_delegate.h"
19 #include "ui/views/widget/widget.h" 20 #include "ui/views/widget/widget.h"
20 21
21 namespace ash { 22 namespace ash {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 tooltip_manager_->ShowTooltip(shelf_view_->GetAppListButton()); 161 tooltip_manager_->ShowTooltip(shelf_view_->GetAppListButton());
161 EXPECT_TRUE(tooltip_manager_->IsVisible()); 162 EXPECT_TRUE(tooltip_manager_->IsVisible());
162 163
163 // ShowTooltipWithDelay should run the timer for an auto-hide-shown shelf. 164 // ShowTooltipWithDelay should run the timer for an auto-hide-shown shelf.
164 tooltip_manager_->ShowTooltipWithDelay(shelf_view_->GetAppListButton()); 165 tooltip_manager_->ShowTooltipWithDelay(shelf_view_->GetAppListButton());
165 EXPECT_TRUE(IsTimerRunning()); 166 EXPECT_TRUE(IsTimerRunning());
166 } 167 }
167 168
168 TEST_F(ShelfTooltipManagerTest, HideForEvents) { 169 TEST_F(ShelfTooltipManagerTest, HideForEvents) {
169 // TODO: investigate failure in mash. http://crbug.com/695563. 170 // TODO: investigate failure in mash. http://crbug.com/695563.
170 if (ShellPort::Get()->IsRunningInMash()) 171 if (Shell::GetAshConfig() == Config::MASH)
171 return; 172 return;
172 173
173 ui::test::EventGenerator& generator = GetEventGenerator(); 174 ui::test::EventGenerator& generator = GetEventGenerator();
174 gfx::Rect shelf_bounds = shelf_view_->GetBoundsInScreen(); 175 gfx::Rect shelf_bounds = shelf_view_->GetBoundsInScreen();
175 176
176 // Should hide if the mouse exits the shelf area. 177 // Should hide if the mouse exits the shelf area.
177 tooltip_manager_->ShowTooltip(shelf_view_->GetAppListButton()); 178 tooltip_manager_->ShowTooltip(shelf_view_->GetAppListButton());
178 ASSERT_TRUE(tooltip_manager_->IsVisible()); 179 ASSERT_TRUE(tooltip_manager_->IsVisible());
179 generator.MoveMouseTo(shelf_bounds.CenterPoint()); 180 generator.MoveMouseTo(shelf_bounds.CenterPoint());
180 generator.SendMouseExit(); 181 generator.SendMouseExit();
(...skipping 15 matching lines...) Expand all
196 197
197 // Should hide for gesture events in the shelf. 198 // Should hide for gesture events in the shelf.
198 tooltip_manager_->ShowTooltip(shelf_view_->GetAppListButton()); 199 tooltip_manager_->ShowTooltip(shelf_view_->GetAppListButton());
199 ASSERT_TRUE(tooltip_manager_->IsVisible()); 200 ASSERT_TRUE(tooltip_manager_->IsVisible());
200 generator.GestureTapDownAndUp(shelf_bounds.CenterPoint()); 201 generator.GestureTapDownAndUp(shelf_bounds.CenterPoint());
201 EXPECT_FALSE(tooltip_manager_->IsVisible()); 202 EXPECT_FALSE(tooltip_manager_->IsVisible());
202 } 203 }
203 204
204 TEST_F(ShelfTooltipManagerTest, HideForExternalEvents) { 205 TEST_F(ShelfTooltipManagerTest, HideForExternalEvents) {
205 // TODO: investigate failure in mash. http://crbug.com/695563. 206 // TODO: investigate failure in mash. http://crbug.com/695563.
206 if (ShellPort::Get()->IsRunningInMash()) 207 if (Shell::GetAshConfig() == Config::MASH)
207 return; 208 return;
208 209
209 ui::test::EventGenerator& generator = GetEventGenerator(); 210 ui::test::EventGenerator& generator = GetEventGenerator();
210 211
211 // Should hide for touches outside the shelf. 212 // Should hide for touches outside the shelf.
212 tooltip_manager_->ShowTooltip(shelf_view_->GetAppListButton()); 213 tooltip_manager_->ShowTooltip(shelf_view_->GetAppListButton());
213 ASSERT_TRUE(tooltip_manager_->IsVisible()); 214 ASSERT_TRUE(tooltip_manager_->IsVisible());
214 generator.set_current_location(gfx::Point()); 215 generator.set_current_location(gfx::Point());
215 generator.PressTouch(); 216 generator.PressTouch();
216 EXPECT_FALSE(tooltip_manager_->IsVisible()); 217 EXPECT_FALSE(tooltip_manager_->IsVisible());
(...skipping 20 matching lines...) Expand all
237 238
238 // Should not hide for key events. 239 // Should not hide for key events.
239 tooltip_manager_->ShowTooltip(shelf_view_->GetAppListButton()); 240 tooltip_manager_->ShowTooltip(shelf_view_->GetAppListButton());
240 ASSERT_TRUE(tooltip_manager_->IsVisible()); 241 ASSERT_TRUE(tooltip_manager_->IsVisible());
241 generator.PressKey(ui::VKEY_A, ui::EF_NONE); 242 generator.PressKey(ui::VKEY_A, ui::EF_NONE);
242 EXPECT_TRUE(tooltip_manager_->IsVisible()); 243 EXPECT_TRUE(tooltip_manager_->IsVisible());
243 } 244 }
244 245
245 } // namespace test 246 } // namespace test
246 } // namespace ash 247 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_layout_manager_unittest.cc ('k') | ash/shelf/shelf_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698