OLD | NEW |
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/public/cpp/config.h" | 5 #include "ash/public/cpp/config.h" |
6 #include "ash/public/cpp/shell_window_ids.h" | 6 #include "ash/public/cpp/shell_window_ids.h" |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
9 #include "ash/test/test_activation_delegate.h" | 9 #include "ash/test/test_activation_delegate.h" |
10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 cursor_manager->AddObserver(&observer_a); | 841 cursor_manager->AddObserver(&observer_a); |
842 cursor_manager->AddObserver(&observer_b); | 842 cursor_manager->AddObserver(&observer_b); |
843 | 843 |
844 // Initial state before any events have been sent. | 844 // Initial state before any events have been sent. |
845 observer_a.reset(); | 845 observer_a.reset(); |
846 observer_b.reset(); | 846 observer_b.reset(); |
847 EXPECT_FALSE(observer_a.did_visibility_change()); | 847 EXPECT_FALSE(observer_a.did_visibility_change()); |
848 EXPECT_FALSE(observer_b.did_visibility_change()); | 848 EXPECT_FALSE(observer_b.did_visibility_change()); |
849 EXPECT_FALSE(observer_a.is_cursor_visible()); | 849 EXPECT_FALSE(observer_a.is_cursor_visible()); |
850 EXPECT_FALSE(observer_b.is_cursor_visible()); | 850 EXPECT_FALSE(observer_b.is_cursor_visible()); |
851 EXPECT_FALSE(observer_a.did_cursor_set_change()); | 851 EXPECT_FALSE(observer_a.did_cursor_size_change()); |
852 EXPECT_FALSE(observer_b.did_cursor_set_change()); | 852 EXPECT_FALSE(observer_b.did_cursor_size_change()); |
853 | 853 |
854 // Keypress should hide the cursor. | 854 // Keypress should hide the cursor. |
855 generator.PressKey(ui::VKEY_A, ui::EF_NONE); | 855 generator.PressKey(ui::VKEY_A, ui::EF_NONE); |
856 EXPECT_TRUE(observer_a.did_visibility_change()); | 856 EXPECT_TRUE(observer_a.did_visibility_change()); |
857 EXPECT_TRUE(observer_b.did_visibility_change()); | 857 EXPECT_TRUE(observer_b.did_visibility_change()); |
858 EXPECT_FALSE(observer_a.is_cursor_visible()); | 858 EXPECT_FALSE(observer_a.is_cursor_visible()); |
859 EXPECT_FALSE(observer_b.is_cursor_visible()); | 859 EXPECT_FALSE(observer_b.is_cursor_visible()); |
860 | 860 |
861 // Set cursor set. | 861 // Set cursor set. |
862 cursor_manager->SetCursorSet(ui::CURSOR_SET_LARGE); | 862 cursor_manager->SetCursorSize(ui::CursorSize::kLarge); |
863 EXPECT_TRUE(observer_a.did_cursor_set_change()); | 863 EXPECT_TRUE(observer_a.did_cursor_size_change()); |
864 EXPECT_EQ(ui::CURSOR_SET_LARGE, observer_a.cursor_set()); | 864 EXPECT_EQ(ui::CursorSize::kLarge, observer_a.cursor_size()); |
865 EXPECT_TRUE(observer_b.did_cursor_set_change()); | 865 EXPECT_TRUE(observer_b.did_cursor_size_change()); |
866 EXPECT_EQ(ui::CURSOR_SET_LARGE, observer_b.cursor_set()); | 866 EXPECT_EQ(ui::CursorSize::kLarge, observer_b.cursor_size()); |
867 | 867 |
868 // Mouse move should show the cursor. | 868 // Mouse move should show the cursor. |
869 observer_a.reset(); | 869 observer_a.reset(); |
870 observer_b.reset(); | 870 observer_b.reset(); |
871 generator.MoveMouseTo(50, 50); | 871 generator.MoveMouseTo(50, 50); |
872 EXPECT_TRUE(observer_a.did_visibility_change()); | 872 EXPECT_TRUE(observer_a.did_visibility_change()); |
873 EXPECT_TRUE(observer_b.did_visibility_change()); | 873 EXPECT_TRUE(observer_b.did_visibility_change()); |
874 EXPECT_TRUE(observer_a.is_cursor_visible()); | 874 EXPECT_TRUE(observer_a.is_cursor_visible()); |
875 EXPECT_TRUE(observer_b.is_cursor_visible()); | 875 EXPECT_TRUE(observer_b.is_cursor_visible()); |
876 | 876 |
877 // Remove observer_b. Its OnCursorVisibilityChanged() should | 877 // Remove observer_b. Its OnCursorVisibilityChanged() should |
878 // not be invoked past this point. | 878 // not be invoked past this point. |
879 cursor_manager->RemoveObserver(&observer_b); | 879 cursor_manager->RemoveObserver(&observer_b); |
880 | 880 |
881 // Gesture tap should hide the cursor. | 881 // Gesture tap should hide the cursor. |
882 observer_a.reset(); | 882 observer_a.reset(); |
883 observer_b.reset(); | 883 observer_b.reset(); |
884 generator.GestureTapAt(gfx::Point(25, 25)); | 884 generator.GestureTapAt(gfx::Point(25, 25)); |
885 EXPECT_TRUE(observer_a.did_visibility_change()); | 885 EXPECT_TRUE(observer_a.did_visibility_change()); |
886 EXPECT_FALSE(observer_b.did_visibility_change()); | 886 EXPECT_FALSE(observer_b.did_visibility_change()); |
887 EXPECT_FALSE(observer_a.is_cursor_visible()); | 887 EXPECT_FALSE(observer_a.is_cursor_visible()); |
888 | 888 |
889 // Set back cursor set to normal. | 889 // Set back cursor set to normal. |
890 cursor_manager->SetCursorSet(ui::CURSOR_SET_NORMAL); | 890 cursor_manager->SetCursorSize(ui::CursorSize::kNormal); |
891 EXPECT_TRUE(observer_a.did_cursor_set_change()); | 891 EXPECT_TRUE(observer_a.did_cursor_size_change()); |
892 EXPECT_EQ(ui::CURSOR_SET_NORMAL, observer_a.cursor_set()); | 892 EXPECT_EQ(ui::CursorSize::kNormal, observer_a.cursor_size()); |
893 EXPECT_FALSE(observer_b.did_cursor_set_change()); | 893 EXPECT_FALSE(observer_b.did_cursor_size_change()); |
894 | 894 |
895 // Mouse move should show the cursor. | 895 // Mouse move should show the cursor. |
896 observer_a.reset(); | 896 observer_a.reset(); |
897 observer_b.reset(); | 897 observer_b.reset(); |
898 generator.MoveMouseTo(50, 50); | 898 generator.MoveMouseTo(50, 50); |
899 EXPECT_TRUE(observer_a.did_visibility_change()); | 899 EXPECT_TRUE(observer_a.did_visibility_change()); |
900 EXPECT_FALSE(observer_b.did_visibility_change()); | 900 EXPECT_FALSE(observer_b.did_visibility_change()); |
901 EXPECT_TRUE(observer_a.is_cursor_visible()); | 901 EXPECT_TRUE(observer_a.is_cursor_visible()); |
902 | 902 |
903 cursor_manager->RemoveObserver(&observer_a); | 903 cursor_manager->RemoveObserver(&observer_a); |
904 } | 904 } |
905 | 905 |
906 } // namespace ash | 906 } // namespace ash |
OLD | NEW |