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

Side by Side Diff: ash/wm/window_manager_unittest.cc

Issue 2071553002: Initial support of large mouse cursor on Exosphere (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 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 | « no previous file | components/exo/pointer.h » ('j') | components/exo/pointer.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/common/shell_window_ids.h" 5 #include "ash/common/shell_window_ids.h"
6 #include "ash/shell.h" 6 #include "ash/shell.h"
7 #include "ash/test/ash_test_base.h" 7 #include "ash/test/ash_test_base.h"
8 #include "ash/test/test_activation_delegate.h" 8 #include "ash/test/test_activation_delegate.h"
9 #include "ash/wm/window_util.h" 9 #include "ash/wm/window_util.h"
10 #include "ui/aura/client/cursor_client_observer.h" 10 #include "ui/aura/client/cursor_client_observer.h"
(...skipping 13 matching lines...) Expand all
24 #include "ui/wm/core/compound_event_filter.h" 24 #include "ui/wm/core/compound_event_filter.h"
25 #include "ui/wm/public/activation_client.h" 25 #include "ui/wm/public/activation_client.h"
26 #include "ui/wm/public/activation_delegate.h" 26 #include "ui/wm/public/activation_delegate.h"
27 27
28 namespace { 28 namespace {
29 29
30 class TestingCursorClientObserver : public aura::client::CursorClientObserver { 30 class TestingCursorClientObserver : public aura::client::CursorClientObserver {
31 public: 31 public:
32 TestingCursorClientObserver() 32 TestingCursorClientObserver()
33 : cursor_visibility_(false), 33 : cursor_visibility_(false),
34 did_visibility_change_(false) {} 34 did_visibility_change_(false),
35 void reset() { cursor_visibility_ = did_visibility_change_ = false; } 35 cursor_set_(ui::CURSOR_SET_NORMAL) {}
36 void reset() {
37 cursor_visibility_ = did_visibility_change_ = false;
38 cursor_set_ = ui::CURSOR_SET_NORMAL;
39 }
36 bool is_cursor_visible() const { return cursor_visibility_; } 40 bool is_cursor_visible() const { return cursor_visibility_; }
41 ui::CursorSetType cursor_set() const { return cursor_set_; }
37 bool did_visibility_change() const { return did_visibility_change_; } 42 bool did_visibility_change() const { return did_visibility_change_; }
38 43
39 // Overridden from aura::client::CursorClientObserver: 44 // Overridden from aura::client::CursorClientObserver:
40 void OnCursorVisibilityChanged(bool is_visible) override { 45 void OnCursorVisibilityChanged(bool is_visible) override {
41 cursor_visibility_ = is_visible; 46 cursor_visibility_ = is_visible;
42 did_visibility_change_ = true; 47 did_visibility_change_ = true;
43 } 48 }
49 void OnCursorSetChanged(ui::CursorSetType new_cursor_set) override {
50 cursor_set_ = new_cursor_set;
51 }
44 52
45 private: 53 private:
46 bool cursor_visibility_; 54 bool cursor_visibility_;
47 bool did_visibility_change_; 55 bool did_visibility_change_;
56 ui::CursorSetType cursor_set_;
48 57
49 DISALLOW_COPY_AND_ASSIGN(TestingCursorClientObserver); 58 DISALLOW_COPY_AND_ASSIGN(TestingCursorClientObserver);
50 }; 59 };
51 60
52 base::TimeTicks getTime() { 61 base::TimeTicks getTime() {
53 return ui::EventTimeForNow(); 62 return ui::EventTimeForNow();
54 } 63 }
55 64
56 // A slightly changed TestEventHandler which can be configured to return a 65 // A slightly changed TestEventHandler which can be configured to return a
57 // specified value for key/mouse event handling. 66 // specified value for key/mouse event handling.
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 cursor_manager->AddObserver(&observer_a); 817 cursor_manager->AddObserver(&observer_a);
809 cursor_manager->AddObserver(&observer_b); 818 cursor_manager->AddObserver(&observer_b);
810 819
811 // Initial state before any events have been sent. 820 // Initial state before any events have been sent.
812 observer_a.reset(); 821 observer_a.reset();
813 observer_b.reset(); 822 observer_b.reset();
814 EXPECT_FALSE(observer_a.did_visibility_change()); 823 EXPECT_FALSE(observer_a.did_visibility_change());
815 EXPECT_FALSE(observer_b.did_visibility_change()); 824 EXPECT_FALSE(observer_b.did_visibility_change());
816 EXPECT_FALSE(observer_a.is_cursor_visible()); 825 EXPECT_FALSE(observer_a.is_cursor_visible());
817 EXPECT_FALSE(observer_b.is_cursor_visible()); 826 EXPECT_FALSE(observer_b.is_cursor_visible());
827 EXPECT_EQ(ui::CURSOR_SET_NORMAL, observer_a.cursor_set());
828 EXPECT_EQ(ui::CURSOR_SET_NORMAL, observer_b.cursor_set());
818 829
819 // Keypress should hide the cursor. 830 // Keypress should hide the cursor.
820 generator.PressKey(ui::VKEY_A, ui::EF_NONE); 831 generator.PressKey(ui::VKEY_A, ui::EF_NONE);
821 EXPECT_TRUE(observer_a.did_visibility_change()); 832 EXPECT_TRUE(observer_a.did_visibility_change());
822 EXPECT_TRUE(observer_b.did_visibility_change()); 833 EXPECT_TRUE(observer_b.did_visibility_change());
823 EXPECT_FALSE(observer_a.is_cursor_visible()); 834 EXPECT_FALSE(observer_a.is_cursor_visible());
824 EXPECT_FALSE(observer_b.is_cursor_visible()); 835 EXPECT_FALSE(observer_b.is_cursor_visible());
825 836
837 // Set cursor set.
838 cursor_manager->SetCursorSet(ui::CURSOR_SET_LARGE);
839 EXPECT_EQ(ui::CURSOR_SET_LARGE, observer_a.cursor_set());
840 EXPECT_EQ(ui::CURSOR_SET_LARGE, observer_b.cursor_set());
841
826 // Mouse move should show the cursor. 842 // Mouse move should show the cursor.
827 observer_a.reset(); 843 observer_a.reset();
828 observer_b.reset(); 844 observer_b.reset();
829 generator.MoveMouseTo(50, 50); 845 generator.MoveMouseTo(50, 50);
830 EXPECT_TRUE(observer_a.did_visibility_change()); 846 EXPECT_TRUE(observer_a.did_visibility_change());
831 EXPECT_TRUE(observer_b.did_visibility_change()); 847 EXPECT_TRUE(observer_b.did_visibility_change());
832 EXPECT_TRUE(observer_a.is_cursor_visible()); 848 EXPECT_TRUE(observer_a.is_cursor_visible());
833 EXPECT_TRUE(observer_b.is_cursor_visible()); 849 EXPECT_TRUE(observer_b.is_cursor_visible());
834 850
835 // Remove observer_b. Its OnCursorVisibilityChanged() should 851 // Remove observer_b. Its OnCursorVisibilityChanged() should
836 // not be invoked past this point. 852 // not be invoked past this point.
837 cursor_manager->RemoveObserver(&observer_b); 853 cursor_manager->RemoveObserver(&observer_b);
838 854
839 // Gesture tap should hide the cursor. 855 // Gesture tap should hide the cursor.
840 observer_a.reset(); 856 observer_a.reset();
841 observer_b.reset(); 857 observer_b.reset();
842 generator.GestureTapAt(gfx::Point(25, 25)); 858 generator.GestureTapAt(gfx::Point(25, 25));
843 EXPECT_TRUE(observer_a.did_visibility_change()); 859 EXPECT_TRUE(observer_a.did_visibility_change());
844 EXPECT_FALSE(observer_b.did_visibility_change()); 860 EXPECT_FALSE(observer_b.did_visibility_change());
845 EXPECT_FALSE(observer_a.is_cursor_visible()); 861 EXPECT_FALSE(observer_a.is_cursor_visible());
846 862
863 // Set cursor set.
864 cursor_manager->SetCursorSet(ui::CURSOR_SET_LARGE);
865 EXPECT_EQ(ui::CURSOR_SET_LARGE, observer_a.cursor_set());
866 EXPECT_EQ(ui::CURSOR_SET_NORMAL, observer_b.cursor_set());
867
847 // Mouse move should show the cursor. 868 // Mouse move should show the cursor.
848 observer_a.reset(); 869 observer_a.reset();
849 observer_b.reset(); 870 observer_b.reset();
850 generator.MoveMouseTo(50, 50); 871 generator.MoveMouseTo(50, 50);
851 EXPECT_TRUE(observer_a.did_visibility_change()); 872 EXPECT_TRUE(observer_a.did_visibility_change());
852 EXPECT_FALSE(observer_b.did_visibility_change()); 873 EXPECT_FALSE(observer_b.did_visibility_change());
853 EXPECT_TRUE(observer_a.is_cursor_visible()); 874 EXPECT_TRUE(observer_a.is_cursor_visible());
854 875
855 cursor_manager->RemoveObserver(&observer_a); 876 cursor_manager->RemoveObserver(&observer_a);
856 } 877 }
857 #endif // defined(OS_CHROMEOS) 878 #endif // defined(OS_CHROMEOS)
858 879
859 } // namespace ash 880 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | components/exo/pointer.h » ('j') | components/exo/pointer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698