Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Unified Diff: ui/views/corewm/tooltip_controller_unittest.cc

Issue 23903056: Add a container window to host the desktop window hierarchy in AURA. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/corewm/tooltip_controller.cc ('k') | ui/views/widget/desktop_aura/desktop_focus_rules.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/corewm/tooltip_controller_unittest.cc
===================================================================
--- ui/views/corewm/tooltip_controller_unittest.cc (revision 224198)
+++ ui/views/corewm/tooltip_controller_unittest.cc (working copy)
@@ -499,6 +499,47 @@
EXPECT_TRUE(tooltip_reparented);
widget2->Close();
}
+
+// This test validates whether the tooltip after becoming visible stays at the
+// top of the ZOrder in its root window after activation changes.
+TEST_F(TooltipControllerTest, TooltipAtTopOfZOrderAfterActivation) {
+ view_->set_tooltip_text(ASCIIToUTF16("Tooltip Text"));
+ EXPECT_EQ(string16(), helper_->GetTooltipText());
+ EXPECT_EQ(NULL, helper_->GetTooltipWindow());
+ generator_->MoveMouseToCenterOf(GetWindow());
+
+ EXPECT_EQ(GetWindow(), GetRootWindow()->GetEventHandlerForPoint(
+ generator_->current_location()));
+ string16 expected_tooltip = ASCIIToUTF16("Tooltip Text");
+ EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(GetWindow()));
+ EXPECT_EQ(string16(), helper_->GetTooltipText());
+ EXPECT_EQ(GetWindow(), helper_->GetTooltipWindow());
+
+ // Fire tooltip timer so tooltip becomes visible.
+ helper_->FireTooltipTimer();
+
+ EXPECT_TRUE(helper_->IsTooltipVisible());
+ generator_->MoveMouseBy(1, 0);
+
+ EXPECT_TRUE(helper_->IsTooltipVisible());
+ EXPECT_EQ(expected_tooltip, aura::client::GetTooltipText(GetWindow()));
+ EXPECT_EQ(expected_tooltip, helper_->GetTooltipText());
+ EXPECT_EQ(GetWindow(), helper_->GetTooltipWindow());
+
+ // Fake activation loss and gain in the native widget. This should cause a
+ // ZOrder change which should not affect the position of the tooltip.
+ DesktopNativeWidgetAura* native_widget =
+ static_cast<DesktopNativeWidgetAura*>(widget_->native_widget());
+ EXPECT_TRUE(native_widget != NULL);
+
+ native_widget->HandleActivationChanged(false);
+ native_widget->HandleActivationChanged(true);
+
+ EXPECT_EQ(
+ widget_->GetNativeWindow()->GetRootWindow()->children().back()->type(),
+ aura::client::WINDOW_TYPE_TOOLTIP);
+}
+
#endif
} // namespace test
« no previous file with comments | « ui/views/corewm/tooltip_controller.cc ('k') | ui/views/widget/desktop_aura/desktop_focus_rules.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698