| 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/shell.h" | 5 #include "ash/shell.h" |
| 6 #include "ash/test/ash_test_base.h" | 6 #include "ash/test/ash_test_base.h" |
| 7 #include "ash/tooltips/tooltip_controller.h" | 7 #include "ash/tooltips/tooltip_controller.h" |
| 8 #include "ash/wm/cursor_manager.h" |
| 8 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 9 #include "ui/aura/client/tooltip_client.h" | 10 #include "ui/aura/client/tooltip_client.h" |
| 10 #include "ui/aura/cursor_manager.h" | |
| 11 #include "ui/aura/env.h" | 11 #include "ui/aura/env.h" |
| 12 #include "ui/aura/root_window.h" | 12 #include "ui/aura/root_window.h" |
| 13 #include "ui/aura/test/event_generator.h" | 13 #include "ui/aura/test/event_generator.h" |
| 14 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
| 15 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
| 16 #include "ui/base/text/text_elider.h" | 16 #include "ui/base/text/text_elider.h" |
| 17 #include "ui/gfx/font.h" | 17 #include "ui/gfx/font.h" |
| 18 #include "ui/gfx/point.h" | 18 #include "ui/gfx/point.h" |
| 19 #include "ui/views/view.h" | 19 #include "ui/views/view.h" |
| 20 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); | 252 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); |
| 253 generator.MoveMouseRelativeTo(widget->GetNativeView(), | 253 generator.MoveMouseRelativeTo(widget->GetNativeView(), |
| 254 view->bounds().CenterPoint()); | 254 view->bounds().CenterPoint()); |
| 255 string16 expected_tooltip = ASCIIToUTF16("Tooltip Text"); | 255 string16 expected_tooltip = ASCIIToUTF16("Tooltip Text"); |
| 256 | 256 |
| 257 // Fire tooltip timer so tooltip becomes visible. | 257 // Fire tooltip timer so tooltip becomes visible. |
| 258 FireTooltipTimer(); | 258 FireTooltipTimer(); |
| 259 EXPECT_TRUE(IsTooltipVisible()); | 259 EXPECT_TRUE(IsTooltipVisible()); |
| 260 | 260 |
| 261 // Hide the cursor and check again. | 261 // Hide the cursor and check again. |
| 262 aura::Env::GetInstance()->cursor_manager()->ShowCursor(false); | 262 ash::Shell::GetInstance()->cursor_manager()->ShowCursor(false); |
| 263 FireTooltipTimer(); | 263 FireTooltipTimer(); |
| 264 EXPECT_FALSE(IsTooltipVisible()); | 264 EXPECT_FALSE(IsTooltipVisible()); |
| 265 | 265 |
| 266 // Show the cursor and re-check. | 266 // Show the cursor and re-check. |
| 267 aura::Env::GetInstance()->cursor_manager()->ShowCursor(true); | 267 ash::Shell::GetInstance()->cursor_manager()->ShowCursor(true); |
| 268 FireTooltipTimer(); | 268 FireTooltipTimer(); |
| 269 EXPECT_TRUE(IsTooltipVisible()); | 269 EXPECT_TRUE(IsTooltipVisible()); |
| 270 } | 270 } |
| 271 | 271 |
| 272 TEST_F(TooltipControllerTest, TrimTooltipToFitTests) { | 272 TEST_F(TooltipControllerTest, TrimTooltipToFitTests) { |
| 273 string16 tooltip; | 273 string16 tooltip; |
| 274 int max_width, line_count, expect_lines; | 274 int max_width, line_count, expect_lines; |
| 275 int max_pixel_width = 400; // copied from constants in tooltip_controller.cc | 275 int max_pixel_width = 400; // copied from constants in tooltip_controller.cc |
| 276 int max_lines = 10; // copied from constants in tooltip_controller.cc | 276 int max_lines = 10; // copied from constants in tooltip_controller.cc |
| 277 gfx::Font font = GetDefaultFont(); | 277 gfx::Font font = GetDefaultFont(); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 EXPECT_TRUE(IsTooltipVisible()); | 466 EXPECT_TRUE(IsTooltipVisible()); |
| 467 EXPECT_TRUE(IsTooltipShownTimerRunning()); | 467 EXPECT_TRUE(IsTooltipShownTimerRunning()); |
| 468 string16 expected_tooltip = ASCIIToUTF16("Tooltip Text for view 2"); | 468 string16 expected_tooltip = ASCIIToUTF16("Tooltip Text for view 2"); |
| 469 EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(window)); | 469 EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(window)); |
| 470 EXPECT_EQ(expected_tooltip, GetTooltipText()); | 470 EXPECT_EQ(expected_tooltip, GetTooltipText()); |
| 471 EXPECT_EQ(window, GetTooltipWindow()); | 471 EXPECT_EQ(window, GetTooltipWindow()); |
| 472 } | 472 } |
| 473 | 473 |
| 474 } // namespace test | 474 } // namespace test |
| 475 } // namespace ash | 475 } // namespace ash |
| OLD | NEW |