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