| 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 RETURN_IF_WIN8; |
| 137 #define MAYBE_TooltipsOnMultiDisplayShouldNotCrash \ | |
| 138 DISABLED_TooltipsOnMultiDisplayShouldNotCrash | |
| 139 #else | |
| 140 #define MAYBE_TooltipsOnMultiDisplayShouldNotCrash \ | |
| 141 TooltipsOnMultiDisplayShouldNotCrash | |
| 142 #endif | |
| 143 | 137 |
| 144 TEST_F(TooltipControllerTest, MAYBE_TooltipsOnMultiDisplayShouldNotCrash) { | |
| 145 UpdateDisplay("1000x600,600x400"); | 138 UpdateDisplay("1000x600,600x400"); |
| 146 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 139 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
| 147 scoped_ptr<views::Widget> widget1(CreateNewWidgetWithBoundsOn( | 140 scoped_ptr<views::Widget> widget1(CreateNewWidgetWithBoundsOn( |
| 148 0, gfx::Rect(10, 10, 100, 100))); | 141 0, gfx::Rect(10, 10, 100, 100))); |
| 149 TooltipTestView* view1 = new TooltipTestView; | 142 TooltipTestView* view1 = new TooltipTestView; |
| 150 AddViewToWidgetAndResize(widget1.get(), view1); | 143 AddViewToWidgetAndResize(widget1.get(), view1); |
| 151 view1->set_tooltip_text(ASCIIToUTF16("Tooltip Text for view 1")); | 144 view1->set_tooltip_text(ASCIIToUTF16("Tooltip Text for view 1")); |
| 152 EXPECT_EQ(widget1->GetNativeView()->GetRootWindow(), root_windows[0]); | 145 EXPECT_EQ(widget1->GetNativeView()->GetRootWindow(), root_windows[0]); |
| 153 | 146 |
| 154 scoped_ptr<views::Widget> widget2(CreateNewWidgetWithBoundsOn( | 147 scoped_ptr<views::Widget> widget2(CreateNewWidgetWithBoundsOn( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 180 // be able to show tooltips on the primary display. | 173 // be able to show tooltips on the primary display. |
| 181 aura::test::EventGenerator generator1(root_windows[0]); | 174 aura::test::EventGenerator generator1(root_windows[0]); |
| 182 generator1.MoveMouseRelativeTo(widget1->GetNativeView(), | 175 generator1.MoveMouseRelativeTo(widget1->GetNativeView(), |
| 183 view1->bounds().CenterPoint()); | 176 view1->bounds().CenterPoint()); |
| 184 helper_->FireTooltipTimer(); | 177 helper_->FireTooltipTimer(); |
| 185 EXPECT_TRUE(helper_->IsTooltipVisible()); | 178 EXPECT_TRUE(helper_->IsTooltipVisible()); |
| 186 } | 179 } |
| 187 | 180 |
| 188 } // namespace test | 181 } // namespace test |
| 189 } // namespace ash | 182 } // namespace ash |
| OLD | NEW |