OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/views/corewm/tooltip_controller.h" | 5 #include "ui/views/corewm/tooltip_controller.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "ui/aura/client/cursor_client.h" | 8 #include "ui/aura/client/cursor_client.h" |
9 #include "ui/aura/client/tooltip_client.h" | 9 #include "ui/aura/client/tooltip_client.h" |
10 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 EXPECT_TRUE(helper_->IsTooltipTimerRunning()); | 402 EXPECT_TRUE(helper_->IsTooltipTimerRunning()); |
403 helper_->FireTooltipTimer(); | 403 helper_->FireTooltipTimer(); |
404 EXPECT_TRUE(helper_->IsTooltipVisible()); | 404 EXPECT_TRUE(helper_->IsTooltipVisible()); |
405 EXPECT_TRUE(helper_->IsTooltipShownTimerRunning()); | 405 EXPECT_TRUE(helper_->IsTooltipShownTimerRunning()); |
406 string16 expected_tooltip = ASCIIToUTF16("Tooltip Text for view 2"); | 406 string16 expected_tooltip = ASCIIToUTF16("Tooltip Text for view 2"); |
407 EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(window)); | 407 EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(window)); |
408 EXPECT_EQ(expected_tooltip, helper_->GetTooltipText()); | 408 EXPECT_EQ(expected_tooltip, helper_->GetTooltipText()); |
409 EXPECT_EQ(window, helper_->GetTooltipWindow()); | 409 EXPECT_EQ(window, helper_->GetTooltipWindow()); |
410 } | 410 } |
411 | 411 |
| 412 // Verifies a mouse exit event hides the tooltips. |
| 413 TEST_F(TooltipControllerTest, HideOnExit) { |
| 414 view_->set_tooltip_text(ASCIIToUTF16("Tooltip Text")); |
| 415 generator_->MoveMouseToCenterOf(GetWindow()); |
| 416 string16 expected_tooltip = ASCIIToUTF16("Tooltip Text"); |
| 417 EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(GetWindow())); |
| 418 EXPECT_EQ(string16(), helper_->GetTooltipText()); |
| 419 EXPECT_EQ(GetWindow(), helper_->GetTooltipWindow()); |
| 420 |
| 421 // Fire tooltip timer so tooltip becomes visible. |
| 422 helper_->FireTooltipTimer(); |
| 423 |
| 424 EXPECT_TRUE(helper_->IsTooltipVisible()); |
| 425 generator_->SendMouseExit(); |
| 426 EXPECT_FALSE(helper_->IsTooltipVisible()); |
| 427 } |
| 428 |
412 } // namespace test | 429 } // namespace test |
413 } // namespace corewm | 430 } // namespace corewm |
414 } // namespace views | 431 } // namespace views |
OLD | NEW |