| 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/display/display_controller.h" | 5 #include "ash/display/display_controller.h" |
| 6 #include "ash/shell.h" | 6 #include "ash/shell.h" |
| 7 #include "ash/test/ash_test_base.h" | 7 #include "ash/test/ash_test_base.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "ui/aura/client/tooltip_client.h" | 9 #include "ui/aura/client/tooltip_client.h" |
| 10 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 ash::Shell::GetInstance()->cursor_manager()->DisableMouseEvents(); | 125 ash::Shell::GetInstance()->cursor_manager()->DisableMouseEvents(); |
| 126 helper_->FireTooltipTimer(); | 126 helper_->FireTooltipTimer(); |
| 127 EXPECT_FALSE(helper_->IsTooltipVisible()); | 127 EXPECT_FALSE(helper_->IsTooltipVisible()); |
| 128 | 128 |
| 129 // Show the cursor and re-check. | 129 // Show the cursor and re-check. |
| 130 ash::Shell::GetInstance()->cursor_manager()->EnableMouseEvents(); | 130 ash::Shell::GetInstance()->cursor_manager()->EnableMouseEvents(); |
| 131 helper_->FireTooltipTimer(); | 131 helper_->FireTooltipTimer(); |
| 132 EXPECT_TRUE(helper_->IsTooltipVisible()); | 132 EXPECT_TRUE(helper_->IsTooltipVisible()); |
| 133 } | 133 } |
| 134 | 134 |
| 135 #if defined(OS_WIN) | 135 TEST_F(TooltipControllerTest, TooltipsOnMultiDisplayShouldNotCrash) { |
| 136 // Multiple displays are not supported on Windows Ash. http://crbug.com/165962 | 136 if (!SupportsMultipleDisplays()) |
| 137 #define MAYBE_TooltipsOnMultiDisplayShouldNotCrash \ | 137 return; |
| 138 DISABLED_TooltipsOnMultiDisplayShouldNotCrash | |
| 139 #else | |
| 140 #define MAYBE_TooltipsOnMultiDisplayShouldNotCrash \ | |
| 141 TooltipsOnMultiDisplayShouldNotCrash | |
| 142 #endif | |
| 143 | 138 |
| 144 TEST_F(TooltipControllerTest, MAYBE_TooltipsOnMultiDisplayShouldNotCrash) { | |
| 145 UpdateDisplay("1000x600,600x400"); | 139 UpdateDisplay("1000x600,600x400"); |
| 146 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 140 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
| 147 scoped_ptr<views::Widget> widget1(CreateNewWidgetWithBoundsOn( | 141 scoped_ptr<views::Widget> widget1(CreateNewWidgetWithBoundsOn( |
| 148 0, gfx::Rect(10, 10, 100, 100))); | 142 0, gfx::Rect(10, 10, 100, 100))); |
| 149 TooltipTestView* view1 = new TooltipTestView; | 143 TooltipTestView* view1 = new TooltipTestView; |
| 150 AddViewToWidgetAndResize(widget1.get(), view1); | 144 AddViewToWidgetAndResize(widget1.get(), view1); |
| 151 view1->set_tooltip_text(ASCIIToUTF16("Tooltip Text for view 1")); | 145 view1->set_tooltip_text(ASCIIToUTF16("Tooltip Text for view 1")); |
| 152 EXPECT_EQ(widget1->GetNativeView()->GetRootWindow(), root_windows[0]); | 146 EXPECT_EQ(widget1->GetNativeView()->GetRootWindow(), root_windows[0]); |
| 153 | 147 |
| 154 scoped_ptr<views::Widget> widget2(CreateNewWidgetWithBoundsOn( | 148 scoped_ptr<views::Widget> widget2(CreateNewWidgetWithBoundsOn( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 180 // be able to show tooltips on the primary display. | 174 // be able to show tooltips on the primary display. |
| 181 aura::test::EventGenerator generator1(root_windows[0]); | 175 aura::test::EventGenerator generator1(root_windows[0]); |
| 182 generator1.MoveMouseRelativeTo(widget1->GetNativeView(), | 176 generator1.MoveMouseRelativeTo(widget1->GetNativeView(), |
| 183 view1->bounds().CenterPoint()); | 177 view1->bounds().CenterPoint()); |
| 184 helper_->FireTooltipTimer(); | 178 helper_->FireTooltipTimer(); |
| 185 EXPECT_TRUE(helper_->IsTooltipVisible()); | 179 EXPECT_TRUE(helper_->IsTooltipVisible()); |
| 186 } | 180 } |
| 187 | 181 |
| 188 } // namespace test | 182 } // namespace test |
| 189 } // namespace ash | 183 } // namespace ash |
| OLD | NEW |