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

Side by Side Diff: ash/launcher/launcher_tooltip_manager_unittest.cc

Issue 11316323: Cleanup enums for shelf (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: style Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « ash/launcher/launcher_tooltip_manager.cc ('k') | ash/launcher/launcher_view.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/launcher/launcher_tooltip_manager.h" 5 #include "ash/launcher/launcher_tooltip_manager.h"
6 6
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/test/ash_test_base.h" 9 #include "ash/test/ash_test_base.h"
10 #include "ash/wm/shelf_layout_manager.h" 10 #include "ash/wm/shelf_layout_manager.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // Create a full-screen window to hide the shelf. 103 // Create a full-screen window to hide the shelf.
104 scoped_ptr<views::Widget> widget(new views::Widget); 104 scoped_ptr<views::Widget> widget(new views::Widget);
105 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); 105 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
106 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 106 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
107 widget->Init(params); 107 widget->Init(params);
108 widget->SetFullscreen(true); 108 widget->SetFullscreen(true);
109 widget->Show(); 109 widget->Show();
110 110
111 // Once the shelf is hidden, the tooltip should be invisible. 111 // Once the shelf is hidden, the tooltip should be invisible.
112 ASSERT_EQ( 112 ASSERT_EQ(
113 internal::ShelfLayoutManager::HIDDEN, 113 SHELF_HIDDEN,
114 Shell::GetPrimaryRootWindowController()->shelf()->visibility_state()); 114 Shell::GetPrimaryRootWindowController()->shelf()->visibility_state());
115 EXPECT_FALSE(TooltipIsVisible()); 115 EXPECT_FALSE(TooltipIsVisible());
116 116
117 // Do not show the view if the shelf is hidden. 117 // Do not show the view if the shelf is hidden.
118 ShowImmediately(); 118 ShowImmediately();
119 EXPECT_FALSE(TooltipIsVisible()); 119 EXPECT_FALSE(TooltipIsVisible());
120 120
121 // ShowDelayed() doesn't even start the timer for the hidden shelf. 121 // ShowDelayed() doesn't even start the timer for the hidden shelf.
122 ShowDelayed(); 122 ShowDelayed();
123 EXPECT_FALSE(IsTimerRunning()); 123 EXPECT_FALSE(IsTimerRunning());
124 } 124 }
125 125
126 TEST_F(LauncherTooltipManagerTest, HideWhenShelfIsAutoHide) { 126 TEST_F(LauncherTooltipManagerTest, HideWhenShelfIsAutoHide) {
127 ShowImmediately(); 127 ShowImmediately();
128 ASSERT_TRUE(TooltipIsVisible()); 128 ASSERT_TRUE(TooltipIsVisible());
129 129
130 internal::ShelfLayoutManager* shelf = 130 internal::ShelfLayoutManager* shelf =
131 Shell::GetPrimaryRootWindowController()->shelf(); 131 Shell::GetPrimaryRootWindowController()->shelf();
132 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); 132 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
133 shelf->UpdateAutoHideState(); 133 shelf->UpdateAutoHideState();
134 ASSERT_EQ(internal::ShelfLayoutManager::AUTO_HIDE_HIDDEN, 134 ASSERT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
135 shelf->auto_hide_state());
136 135
137 // Tooltip visibility change for auto hide may take time. 136 // Tooltip visibility change for auto hide may take time.
138 EXPECT_TRUE(TooltipIsVisible()); 137 EXPECT_TRUE(TooltipIsVisible());
139 RunAllPendingInMessageLoop(); 138 RunAllPendingInMessageLoop();
140 EXPECT_FALSE(TooltipIsVisible()); 139 EXPECT_FALSE(TooltipIsVisible());
141 140
142 // Do not show the view if the shelf is hidden. 141 // Do not show the view if the shelf is hidden.
143 ShowImmediately(); 142 ShowImmediately();
144 EXPECT_FALSE(TooltipIsVisible()); 143 EXPECT_FALSE(TooltipIsVisible());
145 144
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // Should hide if the mouse is out of the tooltip. 212 // Should hide if the mouse is out of the tooltip.
214 test_api.set_location(tooltip_rect.origin() + gfx::Vector2d(-1, -1)); 213 test_api.set_location(tooltip_rect.origin() + gfx::Vector2d(-1, -1));
215 EXPECT_EQ(ui::ER_UNHANDLED, 214 EXPECT_EQ(ui::ER_UNHANDLED,
216 event_handler->OnMouseEvent(&mouse_event)); 215 event_handler->OnMouseEvent(&mouse_event));
217 RunAllPendingInMessageLoop(); 216 RunAllPendingInMessageLoop();
218 EXPECT_FALSE(TooltipIsVisible()); 217 EXPECT_FALSE(TooltipIsVisible());
219 } 218 }
220 219
221 } // namespace test 220 } // namespace test
222 } // namespace ash 221 } // namespace ash
OLDNEW
« no previous file with comments | « ash/launcher/launcher_tooltip_manager.cc ('k') | ash/launcher/launcher_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698