| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/views/corewm/tooltip_controller.h" | 5 #include "ui/views/corewm/tooltip_controller.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "ui/aura/client/cursor_client.h" | 8 #include "ui/aura/client/cursor_client.h" |
| 9 #include "ui/aura/client/screen_position_client.h" | 9 #include "ui/aura/client/screen_position_client.h" |
| 10 #include "ui/aura/client/tooltip_client.h" | 10 #include "ui/aura/client/tooltip_client.h" |
| 11 #include "ui/aura/client/window_types.h" | 11 #include "ui/aura/client/window_types.h" |
| 12 #include "ui/aura/env.h" | 12 #include "ui/aura/env.h" |
| 13 #include "ui/aura/root_window.h" | 13 #include "ui/aura/root_window.h" |
| 14 #include "ui/aura/test/aura_test_base.h" | 14 #include "ui/aura/test/aura_test_base.h" |
| 15 #include "ui/aura/test/event_generator.h" | 15 #include "ui/aura/test/event_generator.h" |
| 16 #include "ui/aura/test/test_screen.h" | 16 #include "ui/aura/test/test_screen.h" |
| 17 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
| 18 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
| 19 #include "ui/gfx/font.h" | 19 #include "ui/gfx/font.h" |
| 20 #include "ui/gfx/point.h" | 20 #include "ui/gfx/point.h" |
| 21 #include "ui/gfx/screen.h" | 21 #include "ui/gfx/screen.h" |
| 22 #include "ui/gfx/screen_type_delegate.h" | 22 #include "ui/gfx/screen_type_delegate.h" |
| 23 #include "ui/gfx/text_elider.h" | 23 #include "ui/gfx/text_elider.h" |
| 24 #include "ui/views/corewm/tooltip_aura.h" | 24 #include "ui/views/corewm/tooltip_aura.h" |
| 25 #include "ui/views/corewm/tooltip_controller_test_helper.h" | 25 #include "ui/views/corewm/tooltip_controller_test_helper.h" |
| 26 #include "ui/views/corewm/transient_window_stacking_client.h" |
| 26 #include "ui/views/view.h" | 27 #include "ui/views/view.h" |
| 27 #include "ui/views/widget/tooltip_manager.h" | 28 #include "ui/views/widget/tooltip_manager.h" |
| 28 #include "ui/views/widget/widget.h" | 29 #include "ui/views/widget/widget.h" |
| 29 | 30 |
| 30 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
| 31 #include "ui/base/win/scoped_ole_initializer.h" | 32 #include "ui/base/win/scoped_ole_initializer.h" |
| 32 #endif | 33 #endif |
| 33 | 34 |
| 34 #if !defined(OS_CHROMEOS) | 35 #if !defined(OS_CHROMEOS) |
| 35 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 36 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 65 } | 66 } |
| 66 | 67 |
| 67 } // namespace | 68 } // namespace |
| 68 | 69 |
| 69 class TooltipControllerTest : public aura::test::AuraTestBase { | 70 class TooltipControllerTest : public aura::test::AuraTestBase { |
| 70 public: | 71 public: |
| 71 TooltipControllerTest() : view_(NULL) {} | 72 TooltipControllerTest() : view_(NULL) {} |
| 72 virtual ~TooltipControllerTest() {} | 73 virtual ~TooltipControllerTest() {} |
| 73 | 74 |
| 74 virtual void SetUp() OVERRIDE { | 75 virtual void SetUp() OVERRIDE { |
| 76 // SetWindowStackingClient() takes ownership of |
| 77 // TransientWindowStackingClient. |
| 78 aura::client::SetWindowStackingClient( |
| 79 new corewm::TransientWindowStackingClient); |
| 75 aura::test::AuraTestBase::SetUp(); | 80 aura::test::AuraTestBase::SetUp(); |
| 76 #if defined(OS_CHROMEOS) | 81 #if defined(OS_CHROMEOS) |
| 77 controller_.reset(new TooltipController( | 82 controller_.reset(new TooltipController( |
| 78 scoped_ptr<views::corewm::Tooltip>( | 83 scoped_ptr<views::corewm::Tooltip>( |
| 79 new views::corewm::TooltipAura(gfx::SCREEN_TYPE_ALTERNATE)))); | 84 new views::corewm::TooltipAura(gfx::SCREEN_TYPE_ALTERNATE)))); |
| 80 root_window()->AddPreTargetHandler(controller_.get()); | 85 root_window()->AddPreTargetHandler(controller_.get()); |
| 81 SetTooltipClient(root_window(), controller_.get()); | 86 SetTooltipClient(root_window(), controller_.get()); |
| 82 #endif | 87 #endif |
| 83 widget_.reset(CreateWidget(root_window())); | 88 widget_.reset(CreateWidget(root_window())); |
| 84 widget_->SetContentsView(new View); | 89 widget_->SetContentsView(new View); |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 EXPECT_EQ( | 606 EXPECT_EQ( |
| 602 widget_->GetNativeWindow()->GetRootWindow()->children().back()->type(), | 607 widget_->GetNativeWindow()->GetRootWindow()->children().back()->type(), |
| 603 aura::client::WINDOW_TYPE_TOOLTIP); | 608 aura::client::WINDOW_TYPE_TOOLTIP); |
| 604 } | 609 } |
| 605 | 610 |
| 606 #endif | 611 #endif |
| 607 | 612 |
| 608 } // namespace test | 613 } // namespace test |
| 609 } // namespace corewm | 614 } // namespace corewm |
| 610 } // namespace views | 615 } // namespace views |
| OLD | NEW |