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

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

Issue 1870743003: Ensure that the cursor visibility state is restored correctly on CursorManager creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/wm/core/cursor_manager.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 "ui/aura/client/cursor_client_observer.h" 8 #include "ui/aura/client/cursor_client_observer.h"
9 #include "ui/aura/test/aura_test_base.h" 9 #include "ui/aura/test/aura_test_base.h"
10 #include "ui/wm/core/native_cursor_manager.h" 10 #include "ui/wm/core/native_cursor_manager.h"
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 EXPECT_FALSE(observer_a.is_cursor_visible()); 318 EXPECT_FALSE(observer_a.is_cursor_visible());
319 319
320 // Show the cursor using ShowCursor(). 320 // Show the cursor using ShowCursor().
321 observer_a.reset(); 321 observer_a.reset();
322 observer_b.reset(); 322 observer_b.reset();
323 cursor_manager_.ShowCursor(); 323 cursor_manager_.ShowCursor();
324 EXPECT_TRUE(observer_a.did_visibility_change()); 324 EXPECT_TRUE(observer_a.did_visibility_change());
325 EXPECT_FALSE(observer_b.did_visibility_change()); 325 EXPECT_FALSE(observer_b.did_visibility_change());
326 EXPECT_TRUE(observer_a.is_cursor_visible()); 326 EXPECT_TRUE(observer_a.is_cursor_visible());
327 } 327 }
328
329 // This test validates that the cursor visiblity state is restored when a
330 // CursorManager instance is destroyed and recreated.
331 TEST(CursorManagerCreateDestroyTest, VisibilityTest) {
332 // This block ensures that the cursor is hidden when the CursorManager
333 // instance is destroyed.
334 {
335 wm::CursorManager cursor_manager1(
336 scoped_ptr<wm::NativeCursorManager>(new TestingCursorManager));
337 cursor_manager1.ShowCursor();
338 EXPECT_TRUE(cursor_manager1.IsCursorVisible());
339 cursor_manager1.HideCursor();
340 EXPECT_FALSE(cursor_manager1.IsCursorVisible());
341 }
342
343 // This block validates that the cursor is hidden initially. It ensures that
344 // the cursor is visible when the CursorManager instance is destroyed.
345 {
346 wm::CursorManager cursor_manager2(
347 scoped_ptr<wm::NativeCursorManager>(new TestingCursorManager));
348 EXPECT_FALSE(cursor_manager2.IsCursorVisible());
349 cursor_manager2.ShowCursor();
350 EXPECT_TRUE(cursor_manager2.IsCursorVisible());
351 }
352
353 // This block validates that the cursor is visible initially. It then
354 // performs normal cursor visibility operations.
355 {
356 wm::CursorManager cursor_manager3(
357 scoped_ptr<wm::NativeCursorManager>(new TestingCursorManager));
358 EXPECT_TRUE(cursor_manager3.IsCursorVisible());
359 cursor_manager3.HideCursor();
360 EXPECT_FALSE(cursor_manager3.IsCursorVisible());
361 }
362 }
OLDNEW
« no previous file with comments | « ui/wm/core/cursor_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698