OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/shell.h" | 5 #include "ash/shell.h" |
6 #include "ash/test/ash_test_base.h" | 6 #include "ash/test/ash_test_base.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "ui/aura/client/tooltip_client.h" | 8 #include "ui/aura/client/tooltip_client.h" |
9 #include "ui/aura/env.h" | 9 #include "ui/aura/env.h" |
10 #include "ui/aura/root_window.h" | 10 #include "ui/aura/root_window.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 RunAllPendingInMessageLoop(); | 131 RunAllPendingInMessageLoop(); |
132 helper_->FireTooltipTimer(); | 132 helper_->FireTooltipTimer(); |
133 EXPECT_TRUE(helper_->IsTooltipVisible()); | 133 EXPECT_TRUE(helper_->IsTooltipVisible()); |
134 } | 134 } |
135 | 135 |
136 TEST_F(TooltipControllerTest, TooltipsOnMultiDisplayShouldNotCrash) { | 136 TEST_F(TooltipControllerTest, TooltipsOnMultiDisplayShouldNotCrash) { |
137 if (!SupportsMultipleDisplays()) | 137 if (!SupportsMultipleDisplays()) |
138 return; | 138 return; |
139 | 139 |
140 UpdateDisplay("1000x600,600x400"); | 140 UpdateDisplay("1000x600,600x400"); |
141 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 141 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
142 scoped_ptr<views::Widget> widget1(CreateNewWidgetWithBoundsOn( | 142 scoped_ptr<views::Widget> widget1(CreateNewWidgetWithBoundsOn( |
143 0, gfx::Rect(10, 10, 100, 100))); | 143 0, gfx::Rect(10, 10, 100, 100))); |
144 TooltipTestView* view1 = new TooltipTestView; | 144 TooltipTestView* view1 = new TooltipTestView; |
145 AddViewToWidgetAndResize(widget1.get(), view1); | 145 AddViewToWidgetAndResize(widget1.get(), view1); |
146 view1->set_tooltip_text(ASCIIToUTF16("Tooltip Text for view 1")); | 146 view1->set_tooltip_text(ASCIIToUTF16("Tooltip Text for view 1")); |
147 EXPECT_EQ(widget1->GetNativeView()->GetRootWindow(), root_windows[0]); | 147 EXPECT_EQ(widget1->GetNativeView()->GetRootWindow(), root_windows[0]); |
148 | 148 |
149 scoped_ptr<views::Widget> widget2(CreateNewWidgetWithBoundsOn( | 149 scoped_ptr<views::Widget> widget2(CreateNewWidgetWithBoundsOn( |
150 1, gfx::Rect(1200, 10, 100, 100))); | 150 1, gfx::Rect(1200, 10, 100, 100))); |
151 TooltipTestView* view2 = new TooltipTestView; | 151 TooltipTestView* view2 = new TooltipTestView; |
(...skipping 23 matching lines...) Expand all Loading... |
175 // be able to show tooltips on the primary display. | 175 // be able to show tooltips on the primary display. |
176 aura::test::EventGenerator generator1(root_windows[0]); | 176 aura::test::EventGenerator generator1(root_windows[0]); |
177 generator1.MoveMouseRelativeTo(widget1->GetNativeView(), | 177 generator1.MoveMouseRelativeTo(widget1->GetNativeView(), |
178 view1->bounds().CenterPoint()); | 178 view1->bounds().CenterPoint()); |
179 helper_->FireTooltipTimer(); | 179 helper_->FireTooltipTimer(); |
180 EXPECT_TRUE(helper_->IsTooltipVisible()); | 180 EXPECT_TRUE(helper_->IsTooltipVisible()); |
181 } | 181 } |
182 | 182 |
183 } // namespace test | 183 } // namespace test |
184 } // namespace ash | 184 } // namespace ash |
OLD | NEW |