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 "ui/wm/core/focus_controller.h" | 5 #include "ui/wm/core/focus_controller.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
10 #include "ui/aura/client/default_capture_client.h" | 10 #include "ui/aura/client/default_capture_client.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "ui/wm/core/wm_state.h" | 26 #include "ui/wm/core/wm_state.h" |
27 #include "ui/wm/public/activation_change_observer.h" | 27 #include "ui/wm/public/activation_change_observer.h" |
28 #include "ui/wm/public/activation_client.h" | 28 #include "ui/wm/public/activation_client.h" |
29 | 29 |
30 namespace wm { | 30 namespace wm { |
31 | 31 |
32 class FocusNotificationObserver : public aura::client::ActivationChangeObserver, | 32 class FocusNotificationObserver : public aura::client::ActivationChangeObserver, |
33 public aura::client::FocusChangeObserver { | 33 public aura::client::FocusChangeObserver { |
34 public: | 34 public: |
35 FocusNotificationObserver() | 35 FocusNotificationObserver() |
36 : activation_changed_count_(0), | 36 : last_activation_reason_(ActivationReason::ACTIVATION_CLIENT), |
| 37 activation_changed_count_(0), |
37 focus_changed_count_(0), | 38 focus_changed_count_(0), |
38 reactivation_count_(0), | 39 reactivation_count_(0), |
39 reactivation_requested_window_(NULL), | 40 reactivation_requested_window_(NULL), |
40 reactivation_actual_window_(NULL) {} | 41 reactivation_actual_window_(NULL) {} |
41 ~FocusNotificationObserver() override {} | 42 ~FocusNotificationObserver() override {} |
42 | 43 |
43 void ExpectCounts(int activation_changed_count, int focus_changed_count) { | 44 void ExpectCounts(int activation_changed_count, int focus_changed_count) { |
44 EXPECT_EQ(activation_changed_count, activation_changed_count_); | 45 EXPECT_EQ(activation_changed_count, activation_changed_count_); |
45 EXPECT_EQ(focus_changed_count, focus_changed_count_); | 46 EXPECT_EQ(focus_changed_count, focus_changed_count_); |
46 } | 47 } |
| 48 ActivationReason last_activation_reason() const { |
| 49 return last_activation_reason_; |
| 50 } |
47 int reactivation_count() const { | 51 int reactivation_count() const { |
48 return reactivation_count_; | 52 return reactivation_count_; |
49 } | 53 } |
50 aura::Window* reactivation_requested_window() const { | 54 aura::Window* reactivation_requested_window() const { |
51 return reactivation_requested_window_; | 55 return reactivation_requested_window_; |
52 } | 56 } |
53 aura::Window* reactivation_actual_window() const { | 57 aura::Window* reactivation_actual_window() const { |
54 return reactivation_actual_window_; | 58 return reactivation_actual_window_; |
55 } | 59 } |
56 | 60 |
57 private: | 61 private: |
58 // Overridden from aura::client::ActivationChangeObserver: | 62 // Overridden from aura::client::ActivationChangeObserver: |
59 void OnWindowActivated(aura::Window* gained_active, | 63 void OnWindowActivated(ActivationReason reason, |
| 64 aura::Window* gained_active, |
60 aura::Window* lost_active) override { | 65 aura::Window* lost_active) override { |
| 66 last_activation_reason_ = reason; |
61 ++activation_changed_count_; | 67 ++activation_changed_count_; |
62 } | 68 } |
63 void OnAttemptToReactivateWindow(aura::Window* request_active, | 69 void OnAttemptToReactivateWindow(aura::Window* request_active, |
64 aura::Window* actual_active) override { | 70 aura::Window* actual_active) override { |
65 ++reactivation_count_; | 71 ++reactivation_count_; |
66 reactivation_requested_window_ = request_active; | 72 reactivation_requested_window_ = request_active; |
67 reactivation_actual_window_ = actual_active; | 73 reactivation_actual_window_ = actual_active; |
68 } | 74 } |
69 | 75 |
70 // Overridden from aura::client::FocusChangeObserver: | 76 // Overridden from aura::client::FocusChangeObserver: |
71 void OnWindowFocused(aura::Window* gained_focus, | 77 void OnWindowFocused(aura::Window* gained_focus, |
72 aura::Window* lost_focus) override { | 78 aura::Window* lost_focus) override { |
73 ++focus_changed_count_; | 79 ++focus_changed_count_; |
74 } | 80 } |
75 | 81 |
| 82 ActivationReason last_activation_reason_; |
76 int activation_changed_count_; | 83 int activation_changed_count_; |
77 int focus_changed_count_; | 84 int focus_changed_count_; |
78 int reactivation_count_; | 85 int reactivation_count_; |
79 aura::Window* reactivation_requested_window_; | 86 aura::Window* reactivation_requested_window_; |
80 aura::Window* reactivation_actual_window_; | 87 aura::Window* reactivation_actual_window_; |
81 | 88 |
82 DISALLOW_COPY_AND_ASSIGN(FocusNotificationObserver); | 89 DISALLOW_COPY_AND_ASSIGN(FocusNotificationObserver); |
83 }; | 90 }; |
84 | 91 |
85 class WindowDeleter { | 92 class WindowDeleter { |
(...skipping 22 matching lines...) Expand all Loading... |
108 ~RecordingActivationAndFocusChangeObserver() override { | 115 ~RecordingActivationAndFocusChangeObserver() override { |
109 aura::client::GetActivationClient(root_)->RemoveObserver(this); | 116 aura::client::GetActivationClient(root_)->RemoveObserver(this); |
110 aura::client::GetFocusClient(root_)->RemoveObserver(this); | 117 aura::client::GetFocusClient(root_)->RemoveObserver(this); |
111 } | 118 } |
112 | 119 |
113 bool was_notified_with_deleted_window() const { | 120 bool was_notified_with_deleted_window() const { |
114 return was_notified_with_deleted_window_; | 121 return was_notified_with_deleted_window_; |
115 } | 122 } |
116 | 123 |
117 // Overridden from aura::client::ActivationChangeObserver: | 124 // Overridden from aura::client::ActivationChangeObserver: |
118 void OnWindowActivated(aura::Window* gained_active, | 125 void OnWindowActivated(ActivationReason reason, |
| 126 aura::Window* gained_active, |
119 aura::Window* lost_active) override { | 127 aura::Window* lost_active) override { |
120 if (lost_active && lost_active == deleter_->GetDeletedWindow()) | 128 if (lost_active && lost_active == deleter_->GetDeletedWindow()) |
121 was_notified_with_deleted_window_ = true; | 129 was_notified_with_deleted_window_ = true; |
122 } | 130 } |
123 | 131 |
124 // Overridden from aura::client::FocusChangeObserver: | 132 // Overridden from aura::client::FocusChangeObserver: |
125 void OnWindowFocused(aura::Window* gained_focus, | 133 void OnWindowFocused(aura::Window* gained_focus, |
126 aura::Window* lost_focus) override { | 134 aura::Window* lost_focus) override { |
127 if (lost_focus && lost_focus == deleter_->GetDeletedWindow()) | 135 if (lost_focus && lost_focus == deleter_->GetDeletedWindow()) |
128 was_notified_with_deleted_window_ = true; | 136 was_notified_with_deleted_window_ = true; |
(...skipping 22 matching lines...) Expand all Loading... |
151 : root_(window->GetRootWindow()), | 159 : root_(window->GetRootWindow()), |
152 window_(window), | 160 window_(window), |
153 did_delete_(false) { | 161 did_delete_(false) { |
154 aura::client::GetActivationClient(root_)->AddObserver(this); | 162 aura::client::GetActivationClient(root_)->AddObserver(this); |
155 } | 163 } |
156 ~DeleteOnLoseActivationChangeObserver() override { | 164 ~DeleteOnLoseActivationChangeObserver() override { |
157 aura::client::GetActivationClient(root_)->RemoveObserver(this); | 165 aura::client::GetActivationClient(root_)->RemoveObserver(this); |
158 } | 166 } |
159 | 167 |
160 // Overridden from aura::client::ActivationChangeObserver: | 168 // Overridden from aura::client::ActivationChangeObserver: |
161 void OnWindowActivated(aura::Window* gained_active, | 169 void OnWindowActivated(ActivationReason reason, |
| 170 aura::Window* gained_active, |
162 aura::Window* lost_active) override { | 171 aura::Window* lost_active) override { |
163 if (window_ && lost_active == window_) { | 172 if (window_ && lost_active == window_) { |
164 delete lost_active; | 173 delete lost_active; |
165 did_delete_ = true; | 174 did_delete_ = true; |
166 } | 175 } |
167 } | 176 } |
168 | 177 |
169 // Overridden from WindowDeleter: | 178 // Overridden from WindowDeleter: |
170 aura::Window* GetDeletedWindow() override { | 179 aura::Window* GetDeletedWindow() override { |
171 return did_delete_ ? window_ : NULL; | 180 return did_delete_ ? window_ : NULL; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 : activated_window_(activated_window), | 305 : activated_window_(activated_window), |
297 shift_focus_to_(NULL) {} | 306 shift_focus_to_(NULL) {} |
298 ~FocusShiftingActivationObserver() override {} | 307 ~FocusShiftingActivationObserver() override {} |
299 | 308 |
300 void set_shift_focus_to(aura::Window* shift_focus_to) { | 309 void set_shift_focus_to(aura::Window* shift_focus_to) { |
301 shift_focus_to_ = shift_focus_to; | 310 shift_focus_to_ = shift_focus_to; |
302 } | 311 } |
303 | 312 |
304 private: | 313 private: |
305 // Overridden from aura::client::ActivationChangeObserver: | 314 // Overridden from aura::client::ActivationChangeObserver: |
306 void OnWindowActivated(aura::Window* gained_active, | 315 void OnWindowActivated(ActivationReason reason, |
| 316 aura::Window* gained_active, |
307 aura::Window* lost_active) override { | 317 aura::Window* lost_active) override { |
308 // Shift focus to a child. This should prevent the default focusing from | 318 // Shift focus to a child. This should prevent the default focusing from |
309 // occurring in FocusController::FocusWindow(). | 319 // occurring in FocusController::FocusWindow(). |
310 if (gained_active == activated_window_) { | 320 if (gained_active == activated_window_) { |
311 aura::client::FocusClient* client = | 321 aura::client::FocusClient* client = |
312 aura::client::GetFocusClient(gained_active); | 322 aura::client::GetFocusClient(gained_active); |
313 client->FocusWindow(shift_focus_to_); | 323 client->FocusWindow(shift_focus_to_); |
314 } | 324 } |
315 } | 325 } |
316 | 326 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 FocusControllerDirectTestBase() {} | 502 FocusControllerDirectTestBase() {} |
493 | 503 |
494 // Different test types shift focus in different ways. | 504 // Different test types shift focus in different ways. |
495 virtual void FocusWindowDirect(aura::Window* window) = 0; | 505 virtual void FocusWindowDirect(aura::Window* window) = 0; |
496 virtual void ActivateWindowDirect(aura::Window* window) = 0; | 506 virtual void ActivateWindowDirect(aura::Window* window) = 0; |
497 virtual void DeactivateWindowDirect(aura::Window* window) = 0; | 507 virtual void DeactivateWindowDirect(aura::Window* window) = 0; |
498 | 508 |
499 // Input events do not change focus if the window can not be focused. | 509 // Input events do not change focus if the window can not be focused. |
500 virtual bool IsInputEvent() = 0; | 510 virtual bool IsInputEvent() = 0; |
501 | 511 |
| 512 // Returns the expected ActivationReason caused by calling the |
| 513 // ActivatedWindowDirect(...) or DeactivateWindowDirect(...) methods. |
| 514 virtual aura::client::ActivationChangeObserver::ActivationReason |
| 515 GetExpectedActivationReason() const = 0; |
| 516 |
502 void FocusWindowById(int id) { | 517 void FocusWindowById(int id) { |
503 aura::Window* window = root_window()->GetChildById(id); | 518 aura::Window* window = root_window()->GetChildById(id); |
504 DCHECK(window); | 519 DCHECK(window); |
505 FocusWindowDirect(window); | 520 FocusWindowDirect(window); |
506 } | 521 } |
507 void ActivateWindowById(int id) { | 522 void ActivateWindowById(int id) { |
508 aura::Window* window = root_window()->GetChildById(id); | 523 aura::Window* window = root_window()->GetChildById(id); |
509 DCHECK(window); | 524 DCHECK(window); |
510 ActivateWindowDirect(window); | 525 ActivateWindowDirect(window); |
511 } | 526 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 ScopedFocusNotificationObserver root_observer(root_window()); | 587 ScopedFocusNotificationObserver root_observer(root_window()); |
573 ScopedTargetFocusNotificationObserver observer1(root_window(), 1); | 588 ScopedTargetFocusNotificationObserver observer1(root_window(), 1); |
574 ScopedTargetFocusNotificationObserver observer2(root_window(), 2); | 589 ScopedTargetFocusNotificationObserver observer2(root_window(), 2); |
575 | 590 |
576 root_observer.ExpectCounts(0, 0); | 591 root_observer.ExpectCounts(0, 0); |
577 observer1.ExpectCounts(0, 0); | 592 observer1.ExpectCounts(0, 0); |
578 observer2.ExpectCounts(0, 0); | 593 observer2.ExpectCounts(0, 0); |
579 | 594 |
580 ActivateWindowById(2); | 595 ActivateWindowById(2); |
581 root_observer.ExpectCounts(1, 1); | 596 root_observer.ExpectCounts(1, 1); |
| 597 EXPECT_EQ(GetExpectedActivationReason(), |
| 598 root_observer.last_activation_reason()); |
582 observer1.ExpectCounts(1, 1); | 599 observer1.ExpectCounts(1, 1); |
583 observer2.ExpectCounts(1, 1); | 600 observer2.ExpectCounts(1, 1); |
584 } | 601 } |
585 void ReactivationEvents() override { | 602 void ReactivationEvents() override { |
586 ActivateWindowById(1); | 603 ActivateWindowById(1); |
587 ScopedFocusNotificationObserver root_observer(root_window()); | 604 ScopedFocusNotificationObserver root_observer(root_window()); |
588 EXPECT_EQ(0, root_observer.reactivation_count()); | 605 EXPECT_EQ(0, root_observer.reactivation_count()); |
589 root_window()->GetChildById(2)->Hide(); | 606 root_window()->GetChildById(2)->Hide(); |
590 // When we attempt to activate "2", which cannot be activated because it | 607 // When we attempt to activate "2", which cannot be activated because it |
591 // is not visible, "1" will be reactivated. | 608 // is not visible, "1" will be reactivated. |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 private: | 905 private: |
889 // Overridden from FocusControllerTestBase: | 906 // Overridden from FocusControllerTestBase: |
890 void FocusWindowDirect(aura::Window* window) override { FocusWindow(window); } | 907 void FocusWindowDirect(aura::Window* window) override { FocusWindow(window); } |
891 void ActivateWindowDirect(aura::Window* window) override { | 908 void ActivateWindowDirect(aura::Window* window) override { |
892 ActivateWindow(window); | 909 ActivateWindow(window); |
893 } | 910 } |
894 void DeactivateWindowDirect(aura::Window* window) override { | 911 void DeactivateWindowDirect(aura::Window* window) override { |
895 DeactivateWindow(window); | 912 DeactivateWindow(window); |
896 } | 913 } |
897 bool IsInputEvent() override { return false; } | 914 bool IsInputEvent() override { return false; } |
| 915 // Overridden from FocusControllerDirectTestBase: |
| 916 aura::client::ActivationChangeObserver::ActivationReason |
| 917 GetExpectedActivationReason() const override { |
| 918 return aura::client::ActivationChangeObserver::ActivationReason:: |
| 919 ACTIVATION_CLIENT; |
| 920 } |
898 | 921 |
899 DISALLOW_COPY_AND_ASSIGN(FocusControllerApiTest); | 922 DISALLOW_COPY_AND_ASSIGN(FocusControllerApiTest); |
900 }; | 923 }; |
901 | 924 |
902 // Focus and Activation changes via input events. | 925 // Focus and Activation changes via input events. |
903 class FocusControllerMouseEventTest : public FocusControllerDirectTestBase { | 926 class FocusControllerMouseEventTest : public FocusControllerDirectTestBase { |
904 public: | 927 public: |
905 FocusControllerMouseEventTest() {} | 928 FocusControllerMouseEventTest() {} |
906 | 929 |
907 // Tests that a handled mouse or gesture event does not trigger a window | 930 // Tests that a handled mouse or gesture event does not trigger a window |
(...skipping 22 matching lines...) Expand all Loading... |
930 void ActivateWindowDirect(aura::Window* window) override { | 953 void ActivateWindowDirect(aura::Window* window) override { |
931 ui::test::EventGenerator generator(root_window(), window); | 954 ui::test::EventGenerator generator(root_window(), window); |
932 generator.ClickLeftButton(); | 955 generator.ClickLeftButton(); |
933 } | 956 } |
934 void DeactivateWindowDirect(aura::Window* window) override { | 957 void DeactivateWindowDirect(aura::Window* window) override { |
935 aura::Window* next_activatable = | 958 aura::Window* next_activatable = |
936 test_focus_rules()->GetNextActivatableWindow(window); | 959 test_focus_rules()->GetNextActivatableWindow(window); |
937 ui::test::EventGenerator generator(root_window(), next_activatable); | 960 ui::test::EventGenerator generator(root_window(), next_activatable); |
938 generator.ClickLeftButton(); | 961 generator.ClickLeftButton(); |
939 } | 962 } |
| 963 // Overridden from FocusControllerDirectTestBase: |
940 bool IsInputEvent() override { return true; } | 964 bool IsInputEvent() override { return true; } |
| 965 aura::client::ActivationChangeObserver::ActivationReason |
| 966 GetExpectedActivationReason() const override { |
| 967 return aura::client::ActivationChangeObserver::ActivationReason:: |
| 968 INPUT_EVENT; |
| 969 } |
941 | 970 |
942 DISALLOW_COPY_AND_ASSIGN(FocusControllerMouseEventTest); | 971 DISALLOW_COPY_AND_ASSIGN(FocusControllerMouseEventTest); |
943 }; | 972 }; |
944 | 973 |
945 class FocusControllerGestureEventTest : public FocusControllerDirectTestBase { | 974 class FocusControllerGestureEventTest : public FocusControllerDirectTestBase { |
946 public: | 975 public: |
947 FocusControllerGestureEventTest() {} | 976 FocusControllerGestureEventTest() {} |
948 | 977 |
949 private: | 978 private: |
950 // Overridden from FocusControllerTestBase: | 979 // Overridden from FocusControllerTestBase: |
951 void FocusWindowDirect(aura::Window* window) override { | 980 void FocusWindowDirect(aura::Window* window) override { |
952 ui::test::EventGenerator generator(root_window(), window); | 981 ui::test::EventGenerator generator(root_window(), window); |
953 generator.GestureTapAt(window->bounds().CenterPoint()); | 982 generator.GestureTapAt(window->bounds().CenterPoint()); |
954 } | 983 } |
955 void ActivateWindowDirect(aura::Window* window) override { | 984 void ActivateWindowDirect(aura::Window* window) override { |
956 ui::test::EventGenerator generator(root_window(), window); | 985 ui::test::EventGenerator generator(root_window(), window); |
957 generator.GestureTapAt(window->bounds().CenterPoint()); | 986 generator.GestureTapAt(window->bounds().CenterPoint()); |
958 } | 987 } |
959 void DeactivateWindowDirect(aura::Window* window) override { | 988 void DeactivateWindowDirect(aura::Window* window) override { |
960 aura::Window* next_activatable = | 989 aura::Window* next_activatable = |
961 test_focus_rules()->GetNextActivatableWindow(window); | 990 test_focus_rules()->GetNextActivatableWindow(window); |
962 ui::test::EventGenerator generator(root_window(), next_activatable); | 991 ui::test::EventGenerator generator(root_window(), next_activatable); |
963 generator.GestureTapAt(window->bounds().CenterPoint()); | 992 generator.GestureTapAt(window->bounds().CenterPoint()); |
964 } | 993 } |
965 bool IsInputEvent() override { return true; } | 994 bool IsInputEvent() override { return true; } |
| 995 aura::client::ActivationChangeObserver::ActivationReason |
| 996 GetExpectedActivationReason() const override { |
| 997 return aura::client::ActivationChangeObserver::ActivationReason:: |
| 998 INPUT_EVENT; |
| 999 } |
966 | 1000 |
967 DISALLOW_COPY_AND_ASSIGN(FocusControllerGestureEventTest); | 1001 DISALLOW_COPY_AND_ASSIGN(FocusControllerGestureEventTest); |
968 }; | 1002 }; |
969 | 1003 |
970 // Test base for tests where focus is implicitly set to a window as the result | 1004 // Test base for tests where focus is implicitly set to a window as the result |
971 // of a disposition change to the focused window or the hierarchy that contains | 1005 // of a disposition change to the focused window or the hierarchy that contains |
972 // it. | 1006 // it. |
973 class FocusControllerImplicitTestBase : public FocusControllerTestBase { | 1007 class FocusControllerImplicitTestBase : public FocusControllerTestBase { |
974 protected: | 1008 protected: |
975 explicit FocusControllerImplicitTestBase(bool parent) : parent_(parent) {} | 1009 explicit FocusControllerImplicitTestBase(bool parent) : parent_(parent) {} |
976 | 1010 |
977 aura::Window* GetDispositionWindow(aura::Window* window) { | 1011 aura::Window* GetDispositionWindow(aura::Window* window) { |
978 return parent_ ? window->parent() : window; | 1012 return parent_ ? window->parent() : window; |
979 } | 1013 } |
980 | 1014 |
| 1015 // Returns the expected ActivationReason caused by calling the |
| 1016 // ActivatedWindowDirect(...) or DeactivateWindowDirect(...) methods. |
| 1017 aura::client::ActivationChangeObserver::ActivationReason |
| 1018 GetExpectedActivationReason() const { |
| 1019 return aura::client::ActivationChangeObserver::ActivationReason:: |
| 1020 WINDOW_DISPOSITION_CHANGED; |
| 1021 } |
| 1022 |
981 // Change the disposition of |window| in such a way as it will lose focus. | 1023 // Change the disposition of |window| in such a way as it will lose focus. |
982 virtual void ChangeWindowDisposition(aura::Window* window) = 0; | 1024 virtual void ChangeWindowDisposition(aura::Window* window) = 0; |
983 | 1025 |
984 // Allow each disposition change test to add additional post-disposition | 1026 // Allow each disposition change test to add additional post-disposition |
985 // change expectations. | 1027 // change expectations. |
986 virtual void PostDispositionChangeExpectations() {} | 1028 virtual void PostDispositionChangeExpectations() {} |
987 | 1029 |
988 // Overridden from FocusControllerTestBase: | 1030 // Overridden from FocusControllerTestBase: |
989 void BasicFocus() override { | 1031 void BasicFocus() override { |
990 EXPECT_EQ(NULL, GetFocusedWindow()); | 1032 EXPECT_EQ(NULL, GetFocusedWindow()); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 | 1073 |
1032 ScopedFocusNotificationObserver root_observer(root_window()); | 1074 ScopedFocusNotificationObserver root_observer(root_window()); |
1033 ScopedTargetFocusNotificationObserver observer2(root_window(), 2); | 1075 ScopedTargetFocusNotificationObserver observer2(root_window(), 2); |
1034 ScopedTargetFocusNotificationObserver observer3(root_window(), 3); | 1076 ScopedTargetFocusNotificationObserver observer3(root_window(), 3); |
1035 root_observer.ExpectCounts(0, 0); | 1077 root_observer.ExpectCounts(0, 0); |
1036 observer2.ExpectCounts(0, 0); | 1078 observer2.ExpectCounts(0, 0); |
1037 observer3.ExpectCounts(0, 0); | 1079 observer3.ExpectCounts(0, 0); |
1038 | 1080 |
1039 ChangeWindowDisposition(w2); | 1081 ChangeWindowDisposition(w2); |
1040 root_observer.ExpectCounts(1, 1); | 1082 root_observer.ExpectCounts(1, 1); |
| 1083 EXPECT_EQ(GetExpectedActivationReason(), |
| 1084 root_observer.last_activation_reason()); |
1041 observer2.ExpectCounts(1, 1); | 1085 observer2.ExpectCounts(1, 1); |
1042 observer3.ExpectCounts(1, 1); | 1086 observer3.ExpectCounts(1, 1); |
1043 } | 1087 } |
1044 void FocusRulesOverride() override { | 1088 void FocusRulesOverride() override { |
1045 EXPECT_EQ(NULL, GetFocusedWindow()); | 1089 EXPECT_EQ(NULL, GetFocusedWindow()); |
1046 aura::Window* w211 = root_window()->GetChildById(211); | 1090 aura::Window* w211 = root_window()->GetChildById(211); |
1047 FocusWindow(w211); | 1091 FocusWindow(w211); |
1048 EXPECT_EQ(211, GetFocusedWindowId()); | 1092 EXPECT_EQ(211, GetFocusedWindowId()); |
1049 | 1093 |
1050 test_focus_rules()->set_focus_restriction(root_window()->GetChildById(11)); | 1094 test_focus_rules()->set_focus_restriction(root_window()->GetChildById(11)); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1301 TransientChildWindowActivationTest); | 1345 TransientChildWindowActivationTest); |
1302 | 1346 |
1303 // - Verifies that the focused text input client is cleard when the window focus | 1347 // - Verifies that the focused text input client is cleard when the window focus |
1304 // changes. | 1348 // changes. |
1305 ALL_FOCUS_TESTS(FocusedTextInputClient); | 1349 ALL_FOCUS_TESTS(FocusedTextInputClient); |
1306 | 1350 |
1307 // If a mouse event was handled, it should not activate a window. | 1351 // If a mouse event was handled, it should not activate a window. |
1308 FOCUS_CONTROLLER_TEST(FocusControllerMouseEventTest, IgnoreHandledEvent); | 1352 FOCUS_CONTROLLER_TEST(FocusControllerMouseEventTest, IgnoreHandledEvent); |
1309 | 1353 |
1310 } // namespace wm | 1354 } // namespace wm |
OLD | NEW |