| 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/client/tooltip_client.h" | 10 #include "ui/aura/client/tooltip_client.h" |
| 11 #include "ui/aura/client/window_types.h" | |
| 12 #include "ui/aura/env.h" | 11 #include "ui/aura/env.h" |
| 13 #include "ui/aura/root_window.h" | 12 #include "ui/aura/root_window.h" |
| 14 #include "ui/aura/test/aura_test_base.h" | 13 #include "ui/aura/test/aura_test_base.h" |
| 15 #include "ui/aura/test/event_generator.h" | 14 #include "ui/aura/test/event_generator.h" |
| 16 #include "ui/aura/test/test_screen.h" | 15 #include "ui/aura/test/test_screen.h" |
| 17 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 18 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
| 19 #include "ui/gfx/font.h" | 18 #include "ui/gfx/font.h" |
| 20 #include "ui/gfx/point.h" | 19 #include "ui/gfx/point.h" |
| 21 #include "ui/gfx/screen.h" | 20 #include "ui/gfx/screen.h" |
| 22 #include "ui/gfx/screen_type_delegate.h" | 21 #include "ui/gfx/screen_type_delegate.h" |
| 23 #include "ui/gfx/text_elider.h" | 22 #include "ui/gfx/text_elider.h" |
| 24 #include "ui/views/corewm/tooltip_aura.h" | 23 #include "ui/views/corewm/tooltip_aura.h" |
| 25 #include "ui/views/corewm/tooltip_controller_test_helper.h" | 24 #include "ui/views/corewm/tooltip_controller_test_helper.h" |
| 26 #include "ui/views/view.h" | 25 #include "ui/views/view.h" |
| 27 #include "ui/views/widget/tooltip_manager.h" | 26 #include "ui/views/widget/tooltip_manager.h" |
| 28 #include "ui/views/widget/widget.h" | 27 #include "ui/views/widget/widget.h" |
| 28 #include "ui/wm/public/window_types.h" |
| 29 | 29 |
| 30 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
| 31 #include "ui/base/win/scoped_ole_initializer.h" | 31 #include "ui/base/win/scoped_ole_initializer.h" |
| 32 #endif | 32 #endif |
| 33 | 33 |
| 34 #if !defined(OS_CHROMEOS) | 34 #if !defined(OS_CHROMEOS) |
| 35 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 35 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 36 #include "ui/views/widget/desktop_aura/desktop_screen.h" | 36 #include "ui/views/widget/desktop_aura/desktop_screen.h" |
| 37 #endif | 37 #endif |
| 38 | 38 |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 generator_->current_location())); | 585 generator_->current_location())); |
| 586 base::string16 expected_tooltip = | 586 base::string16 expected_tooltip = |
| 587 ASCIIToUTF16("Tooltip Text For RootWindow2"); | 587 ASCIIToUTF16("Tooltip Text For RootWindow2"); |
| 588 EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(window2)); | 588 EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(window2)); |
| 589 EXPECT_EQ(expected_tooltip, helper_->GetTooltipText()); | 589 EXPECT_EQ(expected_tooltip, helper_->GetTooltipText()); |
| 590 EXPECT_EQ(window2, helper_->GetTooltipWindow()); | 590 EXPECT_EQ(window2, helper_->GetTooltipWindow()); |
| 591 } | 591 } |
| 592 | 592 |
| 593 bool tooltip_reparented = false; | 593 bool tooltip_reparented = false; |
| 594 for (size_t i = 0; i < root_window2->children().size(); ++i) { | 594 for (size_t i = 0; i < root_window2->children().size(); ++i) { |
| 595 if (root_window2->children()[i]->type() == | 595 if (root_window2->children()[i]->type() == ui::wm::WINDOW_TYPE_TOOLTIP) { |
| 596 aura::client::WINDOW_TYPE_TOOLTIP) { | |
| 597 tooltip_reparented = true; | 596 tooltip_reparented = true; |
| 598 break; | 597 break; |
| 599 } | 598 } |
| 600 } | 599 } |
| 601 EXPECT_TRUE(tooltip_reparented); | 600 EXPECT_TRUE(tooltip_reparented); |
| 602 widget2->Close(); | 601 widget2->Close(); |
| 603 } | 602 } |
| 604 | 603 |
| 605 // This test validates whether the tooltip after becoming visible stays at the | 604 // This test validates whether the tooltip after becoming visible stays at the |
| 606 // top of the ZOrder in its root window after activation changes. | 605 // top of the ZOrder in its root window after activation changes. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 632 // ZOrder change which should not affect the position of the tooltip. | 631 // ZOrder change which should not affect the position of the tooltip. |
| 633 DesktopNativeWidgetAura* native_widget = | 632 DesktopNativeWidgetAura* native_widget = |
| 634 static_cast<DesktopNativeWidgetAura*>(widget_->native_widget()); | 633 static_cast<DesktopNativeWidgetAura*>(widget_->native_widget()); |
| 635 EXPECT_TRUE(native_widget != NULL); | 634 EXPECT_TRUE(native_widget != NULL); |
| 636 | 635 |
| 637 native_widget->HandleActivationChanged(false); | 636 native_widget->HandleActivationChanged(false); |
| 638 native_widget->HandleActivationChanged(true); | 637 native_widget->HandleActivationChanged(true); |
| 639 | 638 |
| 640 EXPECT_EQ( | 639 EXPECT_EQ( |
| 641 widget_->GetNativeWindow()->GetRootWindow()->children().back()->type(), | 640 widget_->GetNativeWindow()->GetRootWindow()->children().back()->type(), |
| 642 aura::client::WINDOW_TYPE_TOOLTIP); | 641 ui::wm::WINDOW_TYPE_TOOLTIP); |
| 643 } | 642 } |
| 644 | 643 |
| 645 #endif | 644 #endif |
| 646 | 645 |
| 647 } // namespace test | 646 } // namespace test |
| 648 } // namespace corewm | 647 } // namespace corewm |
| 649 } // namespace views | 648 } // namespace views |
| OLD | NEW |