| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/test/aura_shell_test_base.h" | 5 #include "ash/test/aura_shell_test_base.h" |
| 6 #include "ash/tooltips/tooltip_controller.h" | 6 #include "ash/tooltips/tooltip_controller.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "ui/aura/client/tooltip_client.h" | 8 #include "ui/aura/client/tooltip_client.h" |
| 9 #include "ui/aura/root_window.h" | 9 #include "ui/aura/root_window.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| 11 #include "ui/gfx/point.h" | 11 #include "ui/gfx/point.h" |
| 12 #include "ui/views/view.h" | 12 #include "ui/views/view.h" |
| 13 #include "ui/views/widget/widget.h" | 13 #include "ui/views/widget/widget.h" |
| 14 | 14 |
| 15 namespace aura_shell { | 15 namespace ash { |
| 16 namespace test { | 16 namespace test { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 class TooltipTestView : public views::View { | 20 class TooltipTestView : public views::View { |
| 21 public: | 21 public: |
| 22 TooltipTestView() : views::View() { | 22 TooltipTestView() : views::View() { |
| 23 } | 23 } |
| 24 | 24 |
| 25 void set_tooltip_text(string16 tooltip_text) { tooltip_text_ = tooltip_text; } | 25 void set_tooltip_text(string16 tooltip_text) { tooltip_text_ = tooltip_text; } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 views::View* contents_view = widget->GetContentsView(); | 58 views::View* contents_view = widget->GetContentsView(); |
| 59 contents_view->AddChildView(view); | 59 contents_view->AddChildView(view); |
| 60 view->SetBounds(contents_view->width(), 0, 100, 100); | 60 view->SetBounds(contents_view->width(), 0, 100, 100); |
| 61 gfx::Rect contents_view_bounds = contents_view->bounds(); | 61 gfx::Rect contents_view_bounds = contents_view->bounds(); |
| 62 contents_view_bounds = contents_view_bounds.Union(view->bounds()); | 62 contents_view_bounds = contents_view_bounds.Union(view->bounds()); |
| 63 contents_view->SetBoundsRect(contents_view_bounds); | 63 contents_view->SetBoundsRect(contents_view_bounds); |
| 64 widget->SetBounds(contents_view_bounds); | 64 widget->SetBounds(contents_view_bounds); |
| 65 } | 65 } |
| 66 | 66 |
| 67 aura_shell::internal::TooltipController* GetController() { | 67 ash::internal::TooltipController* GetController() { |
| 68 return static_cast<aura_shell::internal::TooltipController*>( | 68 return static_cast<ash::internal::TooltipController*>( |
| 69 aura::client::GetTooltipClient()); | 69 aura::client::GetTooltipClient()); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void SimulateMouseMoveAtPoint(const gfx::Point& point) { | 72 void SimulateMouseMoveAtPoint(const gfx::Point& point) { |
| 73 aura::MouseEvent event(ui::ET_MOUSE_MOVED, point, 0); | 73 aura::MouseEvent event(ui::ET_MOUSE_MOVED, point, 0); |
| 74 aura::RootWindow::GetInstance()->DispatchMouseEvent(&event); | 74 aura::RootWindow::GetInstance()->DispatchMouseEvent(&event); |
| 75 } | 75 } |
| 76 | 76 |
| 77 } // namespace | 77 } // namespace |
| 78 | 78 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 aura::RootWindow::GetInstance()->GetEventHandlerForPoint(point)); | 169 aura::RootWindow::GetInstance()->GetEventHandlerForPoint(point)); |
| 170 EXPECT_TRUE(aura::client::GetTooltipText(window) != NULL); | 170 EXPECT_TRUE(aura::client::GetTooltipText(window) != NULL); |
| 171 string16 expected_tooltip = ASCIIToUTF16(""); | 171 string16 expected_tooltip = ASCIIToUTF16(""); |
| 172 EXPECT_EQ(expected_tooltip, *aura::client::GetTooltipText(window)); | 172 EXPECT_EQ(expected_tooltip, *aura::client::GetTooltipText(window)); |
| 173 EXPECT_EQ(expected_tooltip, GetTooltipText()); | 173 EXPECT_EQ(expected_tooltip, GetTooltipText()); |
| 174 EXPECT_EQ(window, GetTooltipWindow()); | 174 EXPECT_EQ(window, GetTooltipWindow()); |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 | 177 |
| 178 } // namespace test | 178 } // namespace test |
| 179 } // namespace aura_shell | 179 } // namespace ash |
| OLD | NEW |