| 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/wm/core/cursor_manager.h" | 5 #include "ui/wm/core/cursor_manager.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/scoped_ptr.h" |
| 8 #include "ui/aura/client/cursor_client_observer.h" | 9 #include "ui/aura/client/cursor_client_observer.h" |
| 9 #include "ui/aura/test/aura_test_base.h" | 10 #include "ui/aura/test/aura_test_base.h" |
| 10 #include "ui/wm/core/native_cursor_manager.h" | 11 #include "ui/wm/core/native_cursor_manager.h" |
| 11 | 12 |
| 12 namespace { | 13 namespace { |
| 13 | 14 |
| 14 class TestingCursorManager : public wm::NativeCursorManager { | 15 class TestingCursorManager : public wm::NativeCursorManager { |
| 15 public: | 16 public: |
| 16 // Overridden from wm::NativeCursorManager: | 17 // Overridden from wm::NativeCursorManager: |
| 17 void SetDisplay(const gfx::Display& display, | 18 void SetDisplay(const gfx::Display& display, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 38 delegate->CommitCursorSet(cursor_set); | 39 delegate->CommitCursorSet(cursor_set); |
| 39 } | 40 } |
| 40 }; | 41 }; |
| 41 | 42 |
| 42 } // namespace | 43 } // namespace |
| 43 | 44 |
| 44 class CursorManagerTest : public aura::test::AuraTestBase { | 45 class CursorManagerTest : public aura::test::AuraTestBase { |
| 45 protected: | 46 protected: |
| 46 CursorManagerTest() | 47 CursorManagerTest() |
| 47 : delegate_(new TestingCursorManager), | 48 : delegate_(new TestingCursorManager), |
| 48 cursor_manager_(scoped_ptr<wm::NativeCursorManager>( | 49 cursor_manager_(std::unique_ptr<wm::NativeCursorManager>(delegate_)) {} |
| 49 delegate_)) { | |
| 50 } | |
| 51 | 50 |
| 52 TestingCursorManager* delegate_; | 51 TestingCursorManager* delegate_; |
| 53 wm::CursorManager cursor_manager_; | 52 wm::CursorManager cursor_manager_; |
| 54 }; | 53 }; |
| 55 | 54 |
| 56 class TestingCursorClientObserver : public aura::client::CursorClientObserver { | 55 class TestingCursorClientObserver : public aura::client::CursorClientObserver { |
| 57 public: | 56 public: |
| 58 TestingCursorClientObserver() | 57 TestingCursorClientObserver() |
| 59 : cursor_visibility_(false), | 58 : cursor_visibility_(false), |
| 60 did_visibility_change_(false) {} | 59 did_visibility_change_(false) {} |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 // This block validates that the cursor is visible initially. It then | 352 // This block validates that the cursor is visible initially. It then |
| 354 // performs normal cursor visibility operations. | 353 // performs normal cursor visibility operations. |
| 355 { | 354 { |
| 356 wm::CursorManager cursor_manager3( | 355 wm::CursorManager cursor_manager3( |
| 357 scoped_ptr<wm::NativeCursorManager>(new TestingCursorManager)); | 356 scoped_ptr<wm::NativeCursorManager>(new TestingCursorManager)); |
| 358 EXPECT_TRUE(cursor_manager3.IsCursorVisible()); | 357 EXPECT_TRUE(cursor_manager3.IsCursorVisible()); |
| 359 cursor_manager3.HideCursor(); | 358 cursor_manager3.HideCursor(); |
| 360 EXPECT_FALSE(cursor_manager3.IsCursorVisible()); | 359 EXPECT_FALSE(cursor_manager3.IsCursorVisible()); |
| 361 } | 360 } |
| 362 } | 361 } |
| OLD | NEW |