| 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/env.h" | 8 #include "ui/aura/env.h" |
| 9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 10 #include "ui/aura/window_event_dispatcher.h" | 10 #include "ui/aura/window_event_dispatcher.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 // Show the cursor and re-check. | 121 // Show the cursor and re-check. |
| 122 RunAllPendingInMessageLoop(); | 122 RunAllPendingInMessageLoop(); |
| 123 ash::Shell::GetInstance()->cursor_manager()->EnableMouseEvents(); | 123 ash::Shell::GetInstance()->cursor_manager()->EnableMouseEvents(); |
| 124 RunAllPendingInMessageLoop(); | 124 RunAllPendingInMessageLoop(); |
| 125 helper_->FireTooltipTimer(); | 125 helper_->FireTooltipTimer(); |
| 126 EXPECT_TRUE(helper_->IsTooltipVisible()); | 126 EXPECT_TRUE(helper_->IsTooltipVisible()); |
| 127 } | 127 } |
| 128 | 128 |
| 129 TEST_F(TooltipControllerTest, TooltipsOnMultiDisplayShouldNotCrash) { | 129 TEST_F(TooltipControllerTest, TooltipsOnMultiDisplayShouldNotCrash) { |
| 130 if (!SupportsMultipleDisplays()) | |
| 131 return; | |
| 132 | |
| 133 UpdateDisplay("1000x600,600x400"); | 130 UpdateDisplay("1000x600,600x400"); |
| 134 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 131 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 135 std::unique_ptr<views::Widget> widget1( | 132 std::unique_ptr<views::Widget> widget1( |
| 136 CreateNewWidgetWithBoundsOn(0, gfx::Rect(10, 10, 100, 100))); | 133 CreateNewWidgetWithBoundsOn(0, gfx::Rect(10, 10, 100, 100))); |
| 137 TooltipTestView* view1 = new TooltipTestView; | 134 TooltipTestView* view1 = new TooltipTestView; |
| 138 AddViewToWidgetAndResize(widget1.get(), view1); | 135 AddViewToWidgetAndResize(widget1.get(), view1); |
| 139 view1->set_tooltip_text(base::ASCIIToUTF16("Tooltip Text for view 1")); | 136 view1->set_tooltip_text(base::ASCIIToUTF16("Tooltip Text for view 1")); |
| 140 EXPECT_EQ(widget1->GetNativeView()->GetRootWindow(), root_windows[0]); | 137 EXPECT_EQ(widget1->GetNativeView()->GetRootWindow(), root_windows[0]); |
| 141 | 138 |
| 142 std::unique_ptr<views::Widget> widget2( | 139 std::unique_ptr<views::Widget> widget2( |
| (...skipping 20 matching lines...) Expand all Loading... |
| 163 // be able to show tooltips on the primary display. | 160 // be able to show tooltips on the primary display. |
| 164 ui::test::EventGenerator generator1(root_windows[0]); | 161 ui::test::EventGenerator generator1(root_windows[0]); |
| 165 generator1.MoveMouseRelativeTo(widget1->GetNativeView(), | 162 generator1.MoveMouseRelativeTo(widget1->GetNativeView(), |
| 166 view1->bounds().CenterPoint()); | 163 view1->bounds().CenterPoint()); |
| 167 helper_->FireTooltipTimer(); | 164 helper_->FireTooltipTimer(); |
| 168 EXPECT_TRUE(helper_->IsTooltipVisible()); | 165 EXPECT_TRUE(helper_->IsTooltipVisible()); |
| 169 } | 166 } |
| 170 | 167 |
| 171 } // namespace test | 168 } // namespace test |
| 172 } // namespace ash | 169 } // namespace ash |
| OLD | NEW |