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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "components/mus/common/util.h" | 8 #include "components/mus/common/util.h" |
9 #include "components/mus/public/cpp/tests/window_server_test_base.h" | 9 #include "components/mus/public/cpp/tests/window_server_test_base.h" |
10 #include "components/mus/public/cpp/window_observer.h" | 10 #include "components/mus/public/cpp/window_observer.h" |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 FocusChangeObserver observer(window11); | 637 FocusChangeObserver observer(window11); |
638 window11->SetFocus(); | 638 window11->SetFocus(); |
639 ASSERT_TRUE(DoRunLoopWithTimeout()); | 639 ASSERT_TRUE(DoRunLoopWithTimeout()); |
640 ASSERT_NE(nullptr, observer.last_gained_focus()); | 640 ASSERT_NE(nullptr, observer.last_gained_focus()); |
641 ASSERT_NE(nullptr, observer.last_lost_focus()); | 641 ASSERT_NE(nullptr, observer.last_lost_focus()); |
642 EXPECT_EQ(window11->id(), observer.last_gained_focus()->id()); | 642 EXPECT_EQ(window11->id(), observer.last_gained_focus()->id()); |
643 EXPECT_EQ(embedded->GetRoot()->id(), observer.last_lost_focus()->id()); | 643 EXPECT_EQ(embedded->GetRoot()->id(), observer.last_lost_focus()->id()); |
644 } | 644 } |
645 { | 645 { |
646 // Add an observer on the Window that loses focus, and make sure the | 646 // Add an observer on the Window that loses focus, and make sure the |
647 // observer | 647 // observer sees the right values. |
648 // sees the right values. | |
649 FocusChangeObserver observer(window11); | 648 FocusChangeObserver observer(window11); |
650 embedded->GetRoot()->SetFocus(); | 649 embedded->GetRoot()->SetFocus(); |
651 ASSERT_TRUE(DoRunLoopWithTimeout()); | 650 ASSERT_TRUE(DoRunLoopWithTimeout()); |
652 ASSERT_NE(nullptr, observer.last_gained_focus()); | 651 ASSERT_NE(nullptr, observer.last_gained_focus()); |
653 ASSERT_NE(nullptr, observer.last_lost_focus()); | 652 ASSERT_NE(nullptr, observer.last_lost_focus()); |
654 EXPECT_EQ(window11->id(), observer.last_lost_focus()->id()); | 653 EXPECT_EQ(window11->id(), observer.last_lost_focus()->id()); |
655 EXPECT_EQ(embedded->GetRoot()->id(), observer.last_gained_focus()->id()); | 654 EXPECT_EQ(embedded->GetRoot()->id(), observer.last_gained_focus()->id()); |
656 } | 655 } |
657 } | 656 } |
658 | 657 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 WaitForBoundsToChange(embedded_connection->GetRoot()); | 888 WaitForBoundsToChange(embedded_connection->GetRoot()); |
890 EXPECT_TRUE(gfx::Rect(21, 22, 23, 24) == | 889 EXPECT_TRUE(gfx::Rect(21, 22, 23, 24) == |
891 embedded_connection->GetRoot()->bounds()); | 890 embedded_connection->GetRoot()->bounds()); |
892 EXPECT_TRUE(gfx::Insets(1, 2, 3, 4) == | 891 EXPECT_TRUE(gfx::Insets(1, 2, 3, 4) == |
893 embedded_connection->GetRoot()->client_area()); | 892 embedded_connection->GetRoot()->client_area()); |
894 } | 893 } |
895 | 894 |
896 } // namespace ws | 895 } // namespace ws |
897 | 896 |
898 } // namespace mus | 897 } // namespace mus |
OLD | NEW |