Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: ui/wm/core/cursor_manager_unittest.cc

Issue 1917053003: unique_ptr_migration: clean up references to scoped_ptr as of r389721 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/controls/webview/webview_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/memory/ptr_util.h"
9 #include "ui/aura/client/cursor_client_observer.h" 9 #include "ui/aura/client/cursor_client_observer.h"
10 #include "ui/aura/test/aura_test_base.h" 10 #include "ui/aura/test/aura_test_base.h"
11 #include "ui/wm/core/native_cursor_manager.h" 11 #include "ui/wm/core/native_cursor_manager.h"
12 12
13 namespace { 13 namespace {
14 14
15 class TestingCursorManager : public wm::NativeCursorManager { 15 class TestingCursorManager : public wm::NativeCursorManager {
16 public: 16 public:
17 // Overridden from wm::NativeCursorManager: 17 // Overridden from wm::NativeCursorManager:
18 void SetDisplay(const gfx::Display& display, 18 void SetDisplay(const gfx::Display& display,
(...skipping 20 matching lines...) Expand all
39 delegate->CommitCursorSet(cursor_set); 39 delegate->CommitCursorSet(cursor_set);
40 } 40 }
41 }; 41 };
42 42
43 } // namespace 43 } // namespace
44 44
45 class CursorManagerTest : public aura::test::AuraTestBase { 45 class CursorManagerTest : public aura::test::AuraTestBase {
46 protected: 46 protected:
47 CursorManagerTest() 47 CursorManagerTest()
48 : delegate_(new TestingCursorManager), 48 : delegate_(new TestingCursorManager),
49 cursor_manager_(std::unique_ptr<wm::NativeCursorManager>(delegate_)) {} 49 cursor_manager_(base::WrapUnique(delegate_)) {}
50 50
51 TestingCursorManager* delegate_; 51 TestingCursorManager* delegate_;
52 wm::CursorManager cursor_manager_; 52 wm::CursorManager cursor_manager_;
53 }; 53 };
54 54
55 class TestingCursorClientObserver : public aura::client::CursorClientObserver { 55 class TestingCursorClientObserver : public aura::client::CursorClientObserver {
56 public: 56 public:
57 TestingCursorClientObserver() 57 TestingCursorClientObserver()
58 : cursor_visibility_(false), 58 : cursor_visibility_(false),
59 did_visibility_change_(false) {} 59 did_visibility_change_(false) {}
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 EXPECT_TRUE(observer_a.is_cursor_visible()); 325 EXPECT_TRUE(observer_a.is_cursor_visible());
326 } 326 }
327 327
328 // This test validates that the cursor visiblity state is restored when a 328 // This test validates that the cursor visiblity state is restored when a
329 // CursorManager instance is destroyed and recreated. 329 // CursorManager instance is destroyed and recreated.
330 TEST(CursorManagerCreateDestroyTest, VisibilityTest) { 330 TEST(CursorManagerCreateDestroyTest, VisibilityTest) {
331 // This block ensures that the cursor is hidden when the CursorManager 331 // This block ensures that the cursor is hidden when the CursorManager
332 // instance is destroyed. 332 // instance is destroyed.
333 { 333 {
334 wm::CursorManager cursor_manager1( 334 wm::CursorManager cursor_manager1(
335 scoped_ptr<wm::NativeCursorManager>(new TestingCursorManager)); 335 base::WrapUnique(new TestingCursorManager));
336 cursor_manager1.ShowCursor(); 336 cursor_manager1.ShowCursor();
337 EXPECT_TRUE(cursor_manager1.IsCursorVisible()); 337 EXPECT_TRUE(cursor_manager1.IsCursorVisible());
338 cursor_manager1.HideCursor(); 338 cursor_manager1.HideCursor();
339 EXPECT_FALSE(cursor_manager1.IsCursorVisible()); 339 EXPECT_FALSE(cursor_manager1.IsCursorVisible());
340 } 340 }
341 341
342 // This block validates that the cursor is hidden initially. It ensures that 342 // This block validates that the cursor is hidden initially. It ensures that
343 // the cursor is visible when the CursorManager instance is destroyed. 343 // the cursor is visible when the CursorManager instance is destroyed.
344 { 344 {
345 wm::CursorManager cursor_manager2( 345 wm::CursorManager cursor_manager2(
346 scoped_ptr<wm::NativeCursorManager>(new TestingCursorManager)); 346 base::WrapUnique(new TestingCursorManager));
347 EXPECT_FALSE(cursor_manager2.IsCursorVisible()); 347 EXPECT_FALSE(cursor_manager2.IsCursorVisible());
348 cursor_manager2.ShowCursor(); 348 cursor_manager2.ShowCursor();
349 EXPECT_TRUE(cursor_manager2.IsCursorVisible()); 349 EXPECT_TRUE(cursor_manager2.IsCursorVisible());
350 } 350 }
351 351
352 // This block validates that the cursor is visible initially. It then 352 // This block validates that the cursor is visible initially. It then
353 // performs normal cursor visibility operations. 353 // performs normal cursor visibility operations.
354 { 354 {
355 wm::CursorManager cursor_manager3( 355 wm::CursorManager cursor_manager3(
356 scoped_ptr<wm::NativeCursorManager>(new TestingCursorManager)); 356 base::WrapUnique(new TestingCursorManager));
357 EXPECT_TRUE(cursor_manager3.IsCursorVisible()); 357 EXPECT_TRUE(cursor_manager3.IsCursorVisible());
358 cursor_manager3.HideCursor(); 358 cursor_manager3.HideCursor();
359 EXPECT_FALSE(cursor_manager3.IsCursorVisible()); 359 EXPECT_FALSE(cursor_manager3.IsCursorVisible());
360 } 360 }
361 } 361 }
OLDNEW
« no previous file with comments | « ui/views/controls/webview/webview_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698