| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/mus/ws/focus_controller.h" | 5 #include "components/mus/ws/focus_controller.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 144 |
| 145 // Tests that focus shifts correctly if the focused window is destroyed. | 145 // Tests that focus shifts correctly if the focused window is destroyed. |
| 146 TEST(FocusControllerTest, FocusShiftsOnDestroy) { | 146 TEST(FocusControllerTest, FocusShiftsOnDestroy) { |
| 147 TestServerWindowDelegate server_window_delegate; | 147 TestServerWindowDelegate server_window_delegate; |
| 148 ServerWindow parent(&server_window_delegate, WindowId()); | 148 ServerWindow parent(&server_window_delegate, WindowId()); |
| 149 server_window_delegate.set_root_window(&parent); | 149 server_window_delegate.set_root_window(&parent); |
| 150 parent.SetVisible(true); | 150 parent.SetVisible(true); |
| 151 ServerWindow child_first(&server_window_delegate, WindowId()); | 151 ServerWindow child_first(&server_window_delegate, WindowId()); |
| 152 child_first.SetVisible(true); | 152 child_first.SetVisible(true); |
| 153 parent.Add(&child_first); | 153 parent.Add(&child_first); |
| 154 scoped_ptr<ServerWindow> child_second( | 154 std::unique_ptr<ServerWindow> child_second( |
| 155 new ServerWindow(&server_window_delegate, WindowId())); | 155 new ServerWindow(&server_window_delegate, WindowId())); |
| 156 child_second->SetVisible(true); | 156 child_second->SetVisible(true); |
| 157 parent.Add(child_second.get()); | 157 parent.Add(child_second.get()); |
| 158 std::vector<uint8_t> dummy; | 158 std::vector<uint8_t> dummy; |
| 159 // Allow only |parent| to be activated. | 159 // Allow only |parent| to be activated. |
| 160 parent.SetProperty(kDisallowActiveChildren, &dummy); | 160 parent.SetProperty(kDisallowActiveChildren, &dummy); |
| 161 | 161 |
| 162 TestFocusControllerObserver focus_observer; | 162 TestFocusControllerObserver focus_observer; |
| 163 focus_observer.set_ignore_explicit(false); | 163 focus_observer.set_ignore_explicit(false); |
| 164 FocusController focus_controller(&focus_observer, &parent); | 164 FocusController focus_controller(&focus_observer, &parent); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 EXPECT_EQ(&child_second, focus_observer.new_active_window()); | 303 EXPECT_EQ(&child_second, focus_observer.new_active_window()); |
| 304 focus_observer.ClearAll(); | 304 focus_observer.ClearAll(); |
| 305 | 305 |
| 306 focus_controller.ActivateNextWindow(); | 306 focus_controller.ActivateNextWindow(); |
| 307 EXPECT_EQ(&child_second, focus_observer.old_active_window()); | 307 EXPECT_EQ(&child_second, focus_observer.old_active_window()); |
| 308 EXPECT_EQ(&parent, focus_observer.new_active_window()); | 308 EXPECT_EQ(&parent, focus_observer.new_active_window()); |
| 309 } | 309 } |
| 310 | 310 |
| 311 } // namespace ws | 311 } // namespace ws |
| 312 } // namespace mus | 312 } // namespace mus |
| OLD | NEW |