| 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/focus_controller.h" | 5 #include "components/mus/focus_controller.h" |
| 6 | 6 |
| 7 #include "components/mus/focus_controller_delegate.h" | 7 #include "components/mus/focus_controller_delegate.h" |
| 8 #include "components/mus/server_view.h" | 8 #include "components/mus/server_view.h" |
| 9 #include "components/mus/test_server_view_delegate.h" | 9 #include "components/mus/test_server_view_delegate.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 namespace view_manager { | 12 namespace mus { |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 class TestFocusControllerDelegate : public FocusControllerDelegate { | 15 class TestFocusControllerDelegate : public FocusControllerDelegate { |
| 16 public: | 16 public: |
| 17 TestFocusControllerDelegate() | 17 TestFocusControllerDelegate() |
| 18 : change_count_(0u), | 18 : change_count_(0u), |
| 19 old_focused_view_(nullptr), | 19 old_focused_view_(nullptr), |
| 20 new_focused_view_(nullptr) {} | 20 new_focused_view_(nullptr) {} |
| 21 | 21 |
| 22 void ClearAll() { | 22 void ClearAll() { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 EXPECT_EQ(0u, focus_delegate.change_count()); | 97 EXPECT_EQ(0u, focus_delegate.change_count()); |
| 98 | 98 |
| 99 // Hide the parent of the focused view. | 99 // Hide the parent of the focused view. |
| 100 child.SetVisible(false); | 100 child.SetVisible(false); |
| 101 EXPECT_EQ(1u, focus_delegate.change_count()); | 101 EXPECT_EQ(1u, focus_delegate.change_count()); |
| 102 EXPECT_EQ(&root, focus_delegate.new_focused_view()); | 102 EXPECT_EQ(&root, focus_delegate.new_focused_view()); |
| 103 EXPECT_EQ(&child_child, focus_delegate.old_focused_view()); | 103 EXPECT_EQ(&child_child, focus_delegate.old_focused_view()); |
| 104 focus_delegate.ClearAll(); | 104 focus_delegate.ClearAll(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace view_manager | 107 } // namespace mus |
| OLD | NEW |