| 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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 EXPECT_EQ(window2, root_window2->GetEventHandlerForPoint( | 546 EXPECT_EQ(window2, root_window2->GetEventHandlerForPoint( |
| 547 generator_->current_location())); | 547 generator_->current_location())); |
| 548 string16 expected_tooltip = ASCIIToUTF16("Tooltip Text For RootWindow2"); | 548 string16 expected_tooltip = ASCIIToUTF16("Tooltip Text For RootWindow2"); |
| 549 EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(window2)); | 549 EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(window2)); |
| 550 EXPECT_EQ(expected_tooltip, helper_->GetTooltipText()); | 550 EXPECT_EQ(expected_tooltip, helper_->GetTooltipText()); |
| 551 EXPECT_EQ(window2, helper_->GetTooltipWindow()); | 551 EXPECT_EQ(window2, helper_->GetTooltipWindow()); |
| 552 } | 552 } |
| 553 | 553 |
| 554 bool tooltip_reparented = false; | 554 bool tooltip_reparented = false; |
| 555 for (size_t i = 0; i < root_window2->children().size(); ++i) { | 555 for (size_t i = 0; i < root_window2->children().size(); ++i) { |
| 556 if (root_window2->children()[i]->type() == | 556 if (root_window2->children()[i]->type() == ui::wm::WINDOW_TYPE_TOOLTIP) { |
| 557 aura::client::WINDOW_TYPE_TOOLTIP) { | |
| 558 tooltip_reparented = true; | 557 tooltip_reparented = true; |
| 559 break; | 558 break; |
| 560 } | 559 } |
| 561 } | 560 } |
| 562 EXPECT_TRUE(tooltip_reparented); | 561 EXPECT_TRUE(tooltip_reparented); |
| 563 widget2->Close(); | 562 widget2->Close(); |
| 564 } | 563 } |
| 565 | 564 |
| 566 // This test validates whether the tooltip after becoming visible stays at the | 565 // This test validates whether the tooltip after becoming visible stays at the |
| 567 // top of the ZOrder in its root window after activation changes. | 566 // top of the ZOrder in its root window after activation changes. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 593 // ZOrder change which should not affect the position of the tooltip. | 592 // ZOrder change which should not affect the position of the tooltip. |
| 594 DesktopNativeWidgetAura* native_widget = | 593 DesktopNativeWidgetAura* native_widget = |
| 595 static_cast<DesktopNativeWidgetAura*>(widget_->native_widget()); | 594 static_cast<DesktopNativeWidgetAura*>(widget_->native_widget()); |
| 596 EXPECT_TRUE(native_widget != NULL); | 595 EXPECT_TRUE(native_widget != NULL); |
| 597 | 596 |
| 598 native_widget->HandleActivationChanged(false); | 597 native_widget->HandleActivationChanged(false); |
| 599 native_widget->HandleActivationChanged(true); | 598 native_widget->HandleActivationChanged(true); |
| 600 | 599 |
| 601 EXPECT_EQ( | 600 EXPECT_EQ( |
| 602 widget_->GetNativeWindow()->GetRootWindow()->children().back()->type(), | 601 widget_->GetNativeWindow()->GetRootWindow()->children().back()->type(), |
| 603 aura::client::WINDOW_TYPE_TOOLTIP); | 602 ui::wm::WINDOW_TYPE_TOOLTIP); |
| 604 } | 603 } |
| 605 | 604 |
| 606 #endif | 605 #endif |
| 607 | 606 |
| 608 } // namespace test | 607 } // namespace test |
| 609 } // namespace corewm | 608 } // namespace corewm |
| 610 } // namespace views | 609 } // namespace views |
| OLD | NEW |