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

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

Issue 1907323003: Drag and drop cleans up touch sequences from the source window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Mac. Created 4 years, 7 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
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/shelf/shelf_layout_manager.h" 7 #include "ash/shelf/shelf_layout_manager.h"
8 #include "ash/shelf/shelf_widget.h" 8 #include "ash/shelf/shelf_widget.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // TODO(msw): Observe events outside the shelf in mash, to close tooltips. 178 // TODO(msw): Observe events outside the shelf in mash, to close tooltips.
179 aura::Window* shelf_window = shelf_->shelf_widget()->GetNativeWindow(); 179 aura::Window* shelf_window = shelf_->shelf_widget()->GetNativeWindow();
180 bool closes = shelf_window->GetRootWindow() == Shell::GetPrimaryRootWindow(); 180 bool closes = shelf_window->GetRootWindow() == Shell::GetPrimaryRootWindow();
181 181
182 // Should hide for touches outside the shelf. 182 // Should hide for touches outside the shelf.
183 ShowImmediately(); 183 ShowImmediately();
184 ASSERT_TRUE(TooltipIsVisible()); 184 ASSERT_TRUE(TooltipIsVisible());
185 generator.set_current_location(gfx::Point()); 185 generator.set_current_location(gfx::Point());
186 generator.PressTouch(); 186 generator.PressTouch();
187 EXPECT_EQ(TooltipIsVisible(), !closes); 187 EXPECT_EQ(TooltipIsVisible(), !closes);
188 generator.ReleaseTouch();
188 189
189 // Should hide for touch events on the tooltip. 190 // Should hide for touch events on the tooltip.
190 ShowImmediately(); 191 ShowImmediately();
191 ASSERT_TRUE(TooltipIsVisible()); 192 ASSERT_TRUE(TooltipIsVisible());
192 generator.set_current_location(GetTooltipWindow()->bounds().CenterPoint()); 193 generator.set_current_location(GetTooltipWindow()->bounds().CenterPoint());
193 generator.PressTouch(); 194 generator.PressTouch();
194 EXPECT_EQ(TooltipIsVisible(), !closes); 195 EXPECT_EQ(TooltipIsVisible(), !closes);
196 generator.ReleaseTouch();
195 197
196 // Should hide for gestures outside the shelf. 198 // Should hide for gestures outside the shelf.
197 ShowImmediately(); 199 ShowImmediately();
198 ASSERT_TRUE(TooltipIsVisible()); 200 ASSERT_TRUE(TooltipIsVisible());
199 generator.GestureTapDownAndUp(gfx::Point()); 201 generator.GestureTapDownAndUp(gfx::Point());
200 EXPECT_EQ(TooltipIsVisible(), !closes); 202 EXPECT_EQ(TooltipIsVisible(), !closes);
201 } 203 }
202 204
203 TEST_F(ShelfTooltipManagerTest, DoNotHideForKeyEvents) { 205 TEST_F(ShelfTooltipManagerTest, DoNotHideForKeyEvents) {
204 ui::test::EventGenerator generator(ash::Shell::GetPrimaryRootWindow()); 206 ui::test::EventGenerator generator(ash::Shell::GetPrimaryRootWindow());
205 207
206 // Should not hide for key events. 208 // Should not hide for key events.
207 ShowImmediately(); 209 ShowImmediately();
208 ASSERT_TRUE(TooltipIsVisible()); 210 ASSERT_TRUE(TooltipIsVisible());
209 generator.PressKey(ui::VKEY_A, ui::EF_NONE); 211 generator.PressKey(ui::VKEY_A, ui::EF_NONE);
210 EXPECT_TRUE(TooltipIsVisible()); 212 EXPECT_TRUE(TooltipIsVisible());
211 } 213 }
212 214
213 } // namespace test 215 } // namespace test
214 } // namespace ash 216 } // namespace ash
OLDNEW
« no previous file with comments | « ash/drag_drop/drag_drop_controller.cc ('k') | chrome/browser/ui/views/tabs/tab_drag_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698