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