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/screen_position_client.h" | 9 #include "ui/aura/client/screen_position_client.h" |
10 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 private: | 459 private: |
460 TestScreenPositionClient screen_position_client_; | 460 TestScreenPositionClient screen_position_client_; |
461 scoped_ptr<gfx::Screen> desktop_screen_; | 461 scoped_ptr<gfx::Screen> desktop_screen_; |
462 | 462 |
463 DISALLOW_COPY_AND_ASSIGN(TooltipControllerCaptureTest); | 463 DISALLOW_COPY_AND_ASSIGN(TooltipControllerCaptureTest); |
464 }; | 464 }; |
465 | 465 |
466 // Verifies when capture is released the TooltipController resets state. | 466 // Verifies when capture is released the TooltipController resets state. |
467 TEST_F(TooltipControllerCaptureTest, CloseOnCaptureLost) { | 467 TEST_F(TooltipControllerCaptureTest, CloseOnCaptureLost) { |
468 view_->GetWidget()->SetCapture(view_); | 468 view_->GetWidget()->SetCapture(view_); |
| 469 RunAllPendingInMessageLoop(); |
469 view_->set_tooltip_text(ASCIIToUTF16("Tooltip Text")); | 470 view_->set_tooltip_text(ASCIIToUTF16("Tooltip Text")); |
470 generator_->MoveMouseToCenterOf(GetWindow()); | 471 generator_->MoveMouseToCenterOf(GetWindow()); |
471 base::string16 expected_tooltip = ASCIIToUTF16("Tooltip Text"); | 472 base::string16 expected_tooltip = ASCIIToUTF16("Tooltip Text"); |
472 EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(GetWindow())); | 473 EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(GetWindow())); |
473 EXPECT_EQ(base::string16(), helper_->GetTooltipText()); | 474 EXPECT_EQ(base::string16(), helper_->GetTooltipText()); |
474 EXPECT_EQ(GetWindow(), helper_->GetTooltipWindow()); | 475 EXPECT_EQ(GetWindow(), helper_->GetTooltipWindow()); |
475 | 476 |
476 // Fire tooltip timer so tooltip becomes visible. | 477 // Fire tooltip timer so tooltip becomes visible. |
477 helper_->FireTooltipTimer(); | 478 helper_->FireTooltipTimer(); |
478 | 479 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 // the tooltip window is closed. | 759 // the tooltip window is closed. |
759 ui::CancelModeEvent event; | 760 ui::CancelModeEvent event; |
760 helper_->controller()->OnCancelMode(&event); | 761 helper_->controller()->OnCancelMode(&event); |
761 EXPECT_FALSE(helper_->IsTooltipVisible()); | 762 EXPECT_FALSE(helper_->IsTooltipVisible()); |
762 EXPECT_TRUE(helper_->GetTooltipWindow() == NULL); | 763 EXPECT_TRUE(helper_->GetTooltipWindow() == NULL); |
763 } | 764 } |
764 | 765 |
765 } // namespace test | 766 } // namespace test |
766 } // namespace corewm | 767 } // namespace corewm |
767 } // namespace views | 768 } // namespace views |
OLD | NEW |