| 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/activation_change_observer.h" | 9 #include "ui/aura/client/activation_change_observer.h" |
| 10 #include "ui/aura/client/activation_client.h" | 10 #include "ui/aura/client/activation_client.h" |
| (...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 FocusControllerHideTest() : FocusControllerImplicitTestBase(false) {} | 998 FocusControllerHideTest() : FocusControllerImplicitTestBase(false) {} |
| 999 | 999 |
| 1000 protected: | 1000 protected: |
| 1001 FocusControllerHideTest(bool parent) | 1001 FocusControllerHideTest(bool parent) |
| 1002 : FocusControllerImplicitTestBase(parent) {} | 1002 : FocusControllerImplicitTestBase(parent) {} |
| 1003 | 1003 |
| 1004 // Overridden from FocusControllerImplicitTestBase: | 1004 // Overridden from FocusControllerImplicitTestBase: |
| 1005 virtual void ChangeWindowDisposition(aura::Window* window) OVERRIDE { | 1005 virtual void ChangeWindowDisposition(aura::Window* window) OVERRIDE { |
| 1006 GetDispositionWindow(window)->Hide(); | 1006 GetDispositionWindow(window)->Hide(); |
| 1007 } | 1007 } |
| 1008 virtual void PostDispostionChangeExpectations() OVERRIDE { | |
| 1009 // BasicActivation() starts with the stacking order: 1, 2, 3 (3 topmost) | |
| 1010 // and then activates 2. After 2 is hidden in ChangeWindowDisposition | |
| 1011 // above, 3 is activated, but code in | |
| 1012 // FocusController::OnWindowVisibilityChanging keeps 2's layer above 3's | |
| 1013 // until a hide animation completes (e.g. a fade-out transition). | |
| 1014 aura::Window* w2 = root_window()->GetChildById(2); | |
| 1015 aura::Window* w3 = root_window()->GetChildById(3); | |
| 1016 | |
| 1017 // W2 was hidden, but its layer should still be stacked above W3's. | |
| 1018 typedef std::vector<ui::Layer*> Layers; | |
| 1019 const Layers& children = w3->parent()->layer()->children(); | |
| 1020 Layers::const_iterator w3_iter = | |
| 1021 std::find(children.begin(), children.end(), w3->layer()); | |
| 1022 Layers::const_iterator w2_iter = | |
| 1023 std::find(children.begin(), children.end(), w2->layer()); | |
| 1024 EXPECT_TRUE(w2_iter > w3_iter); | |
| 1025 } | |
| 1026 | 1008 |
| 1027 private: | 1009 private: |
| 1028 DISALLOW_COPY_AND_ASSIGN(FocusControllerHideTest); | 1010 DISALLOW_COPY_AND_ASSIGN(FocusControllerHideTest); |
| 1029 }; | 1011 }; |
| 1030 | 1012 |
| 1031 // Focus and Activation changes in response to window parent visibility | 1013 // Focus and Activation changes in response to window parent visibility |
| 1032 // changes. | 1014 // changes. |
| 1033 class FocusControllerParentHideTest : public FocusControllerHideTest { | 1015 class FocusControllerParentHideTest : public FocusControllerHideTest { |
| 1034 public: | 1016 public: |
| 1035 FocusControllerParentHideTest() : FocusControllerHideTest(true) {} | 1017 FocusControllerParentHideTest() : FocusControllerHideTest(true) {} |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1193 // Clicking on a window which has capture should not result in a focus change. | 1175 // Clicking on a window which has capture should not result in a focus change. |
| 1194 DIRECT_FOCUS_CHANGE_TESTS(NoFocusChangeOnClickOnCaptureWindow); | 1176 DIRECT_FOCUS_CHANGE_TESTS(NoFocusChangeOnClickOnCaptureWindow); |
| 1195 | 1177 |
| 1196 FOCUS_CONTROLLER_TEST(FocusControllerApiTest, | 1178 FOCUS_CONTROLLER_TEST(FocusControllerApiTest, |
| 1197 ChangeFocusWhenNothingFocusedAndCaptured); | 1179 ChangeFocusWhenNothingFocusedAndCaptured); |
| 1198 | 1180 |
| 1199 // See description above DontPassDeletedWindow() for details. | 1181 // See description above DontPassDeletedWindow() for details. |
| 1200 FOCUS_CONTROLLER_TEST(FocusControllerApiTest, DontPassDeletedWindow); | 1182 FOCUS_CONTROLLER_TEST(FocusControllerApiTest, DontPassDeletedWindow); |
| 1201 | 1183 |
| 1202 } // namespace wm | 1184 } // namespace wm |
| OLD | NEW |