| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "components/mus/common/util.h" | 12 #include "components/mus/common/util.h" |
| 13 #include "components/mus/public/cpp/tests/window_server_test_base.h" | 13 #include "components/mus/public/cpp/tests/window_server_test_base.h" |
| 14 #include "components/mus/public/cpp/window_observer.h" | 14 #include "components/mus/public/cpp/window_observer.h" |
| 15 #include "components/mus/public/cpp/window_tree_connection.h" | 15 #include "components/mus/public/cpp/window_tree_connection.h" |
| 16 #include "components/mus/public/cpp/window_tree_connection_observer.h" | 16 #include "components/mus/public/cpp/window_tree_connection_observer.h" |
| 17 #include "components/mus/public/cpp/window_tree_delegate.h" | 17 #include "components/mus/public/cpp/window_tree_delegate.h" |
| 18 #include "mojo/converters/geometry/geometry_type_converters.h" | 18 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 19 #include "mojo/shell/public/cpp/application_test_base.h" | |
| 20 #include "ui/gfx/geometry/rect.h" | 19 #include "ui/gfx/geometry/rect.h" |
| 21 #include "ui/mojo/geometry/geometry_util.h" | 20 #include "ui/mojo/geometry/geometry_util.h" |
| 22 | 21 |
| 23 namespace mus { | 22 namespace mus { |
| 24 namespace ws { | 23 namespace ws { |
| 25 | 24 |
| 26 namespace { | 25 namespace { |
| 27 | 26 |
| 28 int ValidIndexOf(const Window::Children& windows, Window* window) { | 27 int ValidIndexOf(const Window::Children& windows, Window* window) { |
| 29 Window::Children::const_iterator it = | 28 Window::Children::const_iterator it = |
| (...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 EXPECT_EQ(child21->id(), window_manager()->GetFocusedWindow()->id()); | 837 EXPECT_EQ(child21->id(), window_manager()->GetFocusedWindow()->id()); |
| 839 EXPECT_EQ(child21->id(), embedded2->GetFocusedWindow()->id()); | 838 EXPECT_EQ(child21->id(), embedded2->GetFocusedWindow()->id()); |
| 840 EXPECT_TRUE(WaitForNoWindowToHaveFocus(embedded1)); | 839 EXPECT_TRUE(WaitForNoWindowToHaveFocus(embedded1)); |
| 841 EXPECT_EQ(nullptr, embedded1->GetFocusedWindow()); | 840 EXPECT_EQ(nullptr, embedded1->GetFocusedWindow()); |
| 842 EXPECT_GT(ValidIndexOf(parent->children(), child2), | 841 EXPECT_GT(ValidIndexOf(parent->children(), child2), |
| 843 ValidIndexOf(parent->children(), child1)); | 842 ValidIndexOf(parent->children(), child1)); |
| 844 EXPECT_GT(ValidIndexOf(parent->children(), child3), | 843 EXPECT_GT(ValidIndexOf(parent->children(), child3), |
| 845 ValidIndexOf(parent->children(), child1)); | 844 ValidIndexOf(parent->children(), child1)); |
| 846 } | 845 } |
| 847 | 846 |
| 848 // Very flaky: http://crbug.com/592313. | 847 TEST_F(WindowServerTest, ActivationNext) { |
| 849 TEST_F(WindowServerTest, DISABLED_ActivationNext) { | |
| 850 Window* parent = GetFirstWMRoot(); | 848 Window* parent = GetFirstWMRoot(); |
| 851 Window* child1 = NewVisibleWindow(parent, window_manager()); | 849 Window* child1 = NewVisibleWindow(parent, window_manager()); |
| 852 Window* child2 = NewVisibleWindow(parent, window_manager()); | 850 Window* child2 = NewVisibleWindow(parent, window_manager()); |
| 853 Window* child3 = NewVisibleWindow(parent, window_manager()); | 851 Window* child3 = NewVisibleWindow(parent, window_manager()); |
| 854 | 852 |
| 855 WindowTreeConnection* embedded1 = Embed(child1).connection; | 853 WindowTreeConnection* embedded1 = Embed(child1).connection; |
| 856 ASSERT_NE(nullptr, embedded1); | 854 ASSERT_NE(nullptr, embedded1); |
| 857 WindowTreeConnection* embedded2 = Embed(child2).connection; | 855 WindowTreeConnection* embedded2 = Embed(child2).connection; |
| 858 ASSERT_NE(nullptr, embedded2); | 856 ASSERT_NE(nullptr, embedded2); |
| 859 WindowTreeConnection* embedded3 = Embed(child3).connection; | 857 WindowTreeConnection* embedded3 = Embed(child3).connection; |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1173 ASSERT_TRUE(window_in_wm); | 1171 ASSERT_TRUE(window_in_wm); |
| 1174 | 1172 |
| 1175 // Change the bounds in the wm, and make sure the child sees it. | 1173 // Change the bounds in the wm, and make sure the child sees it. |
| 1176 window_in_wm->SetBounds(gfx::Rect(1, 11, 12, 101)); | 1174 window_in_wm->SetBounds(gfx::Rect(1, 11, 12, 101)); |
| 1177 ASSERT_TRUE(WaitForBoundsToChange(window_in_second_connection)); | 1175 ASSERT_TRUE(WaitForBoundsToChange(window_in_second_connection)); |
| 1178 EXPECT_EQ(gfx::Rect(1, 11, 12, 101), window_in_second_connection->bounds()); | 1176 EXPECT_EQ(gfx::Rect(1, 11, 12, 101), window_in_second_connection->bounds()); |
| 1179 } | 1177 } |
| 1180 | 1178 |
| 1181 } // namespace ws | 1179 } // namespace ws |
| 1182 } // namespace mus | 1180 } // namespace mus |
| OLD | NEW |