| OLD | NEW |
| 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/display/display_controller.h" | 5 #include "ash/display/display_controller.h" |
| 6 #include "ash/shell.h" | 6 #include "ash/shell.h" |
| 7 #include "ash/test/ash_test_base.h" | 7 #include "ash/test/ash_test_base.h" |
| 8 #include "ash/tooltips/tooltip_controller.h" | 8 #include "ash/tooltips/tooltip_controller.h" |
| 9 #include "ash/wm/cursor_manager.h" | 9 #include "ash/wm/cursor_manager.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); | 260 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); |
| 261 generator.MoveMouseRelativeTo(widget->GetNativeView(), | 261 generator.MoveMouseRelativeTo(widget->GetNativeView(), |
| 262 view->bounds().CenterPoint()); | 262 view->bounds().CenterPoint()); |
| 263 string16 expected_tooltip = ASCIIToUTF16("Tooltip Text"); | 263 string16 expected_tooltip = ASCIIToUTF16("Tooltip Text"); |
| 264 | 264 |
| 265 // Fire tooltip timer so tooltip becomes visible. | 265 // Fire tooltip timer so tooltip becomes visible. |
| 266 FireTooltipTimer(); | 266 FireTooltipTimer(); |
| 267 EXPECT_TRUE(IsTooltipVisible()); | 267 EXPECT_TRUE(IsTooltipVisible()); |
| 268 | 268 |
| 269 // Hide the cursor and check again. | 269 // Hide the cursor and check again. |
| 270 ash::Shell::GetInstance()->cursor_manager()->ShowCursor(false); | 270 ash::Shell::GetInstance()->cursor_manager()->DisableMouseEvents(); |
| 271 FireTooltipTimer(); | 271 FireTooltipTimer(); |
| 272 EXPECT_FALSE(IsTooltipVisible()); | 272 EXPECT_FALSE(IsTooltipVisible()); |
| 273 | 273 |
| 274 // Show the cursor and re-check. | 274 // Show the cursor and re-check. |
| 275 ash::Shell::GetInstance()->cursor_manager()->ShowCursor(true); | 275 ash::Shell::GetInstance()->cursor_manager()->EnableMouseEvents(); |
| 276 FireTooltipTimer(); | 276 FireTooltipTimer(); |
| 277 EXPECT_TRUE(IsTooltipVisible()); | 277 EXPECT_TRUE(IsTooltipVisible()); |
| 278 } | 278 } |
| 279 | 279 |
| 280 TEST_F(TooltipControllerTest, TrimTooltipToFitTests) { | 280 TEST_F(TooltipControllerTest, TrimTooltipToFitTests) { |
| 281 string16 tooltip; | 281 string16 tooltip; |
| 282 int max_width, line_count, expect_lines; | 282 int max_width, line_count, expect_lines; |
| 283 int max_pixel_width = 400; // copied from constants in tooltip_controller.cc | 283 int max_pixel_width = 400; // copied from constants in tooltip_controller.cc |
| 284 int max_lines = 10; // copied from constants in tooltip_controller.cc | 284 int max_lines = 10; // copied from constants in tooltip_controller.cc |
| 285 gfx::Font font = GetDefaultFont(); | 285 gfx::Font font = GetDefaultFont(); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 // be able to show tooltips on the primary display. | 518 // be able to show tooltips on the primary display. |
| 519 aura::test::EventGenerator generator1(root_windows[0]); | 519 aura::test::EventGenerator generator1(root_windows[0]); |
| 520 generator1.MoveMouseRelativeTo(widget1->GetNativeView(), | 520 generator1.MoveMouseRelativeTo(widget1->GetNativeView(), |
| 521 view1->bounds().CenterPoint()); | 521 view1->bounds().CenterPoint()); |
| 522 FireTooltipTimer(); | 522 FireTooltipTimer(); |
| 523 EXPECT_TRUE(IsTooltipVisible()); | 523 EXPECT_TRUE(IsTooltipVisible()); |
| 524 } | 524 } |
| 525 | 525 |
| 526 } // namespace test | 526 } // namespace test |
| 527 } // namespace ash | 527 } // namespace ash |
| OLD | NEW |