| 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 "ui/aura/mus/window_tree_client.h" | 5 #include "ui/aura/mus/window_tree_client.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "mojo/common/common_type_converters.h" | 11 #include "mojo/common/common_type_converters.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "ui/aura/client/aura_constants.h" | 13 #include "ui/aura/client/aura_constants.h" |
| 14 #include "ui/aura/client/capture_client.h" | 14 #include "ui/aura/client/capture_client.h" |
| 15 #include "ui/aura/client/capture_client_observer.h" |
| 15 #include "ui/aura/client/focus_client.h" | 16 #include "ui/aura/client/focus_client.h" |
| 16 #include "ui/aura/client/transient_window_client.h" | 17 #include "ui/aura/client/transient_window_client.h" |
| 17 #include "ui/aura/mus/property_converter.h" | 18 #include "ui/aura/mus/property_converter.h" |
| 18 #include "ui/aura/mus/window_mus.h" | 19 #include "ui/aura/mus/window_mus.h" |
| 19 #include "ui/aura/mus/window_tree_client_delegate.h" | 20 #include "ui/aura/mus/window_tree_client_delegate.h" |
| 20 #include "ui/aura/mus/window_tree_client_observer.h" | 21 #include "ui/aura/mus/window_tree_client_observer.h" |
| 21 #include "ui/aura/test/aura_mus_test_base.h" | 22 #include "ui/aura/test/aura_mus_test_base.h" |
| 22 #include "ui/aura/test/mus/test_window_tree.h" | 23 #include "ui/aura/test/mus/test_window_tree.h" |
| 23 #include "ui/aura/test/mus/window_tree_client_private.h" | 24 #include "ui/aura/test/mus/window_tree_client_private.h" |
| 24 #include "ui/aura/test/test_window_delegate.h" | 25 #include "ui/aura/test/test_window_delegate.h" |
| (...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 ASSERT_TRUE(window_tree()->AckSingleChangeOfType( | 1064 ASSERT_TRUE(window_tree()->AckSingleChangeOfType( |
| 1064 WindowTreeChangeType::CAPTURE, true)); | 1065 WindowTreeChangeType::CAPTURE, true)); |
| 1065 EXPECT_EQ(1, capture_recorder.capture_changed_count()); | 1066 EXPECT_EQ(1, capture_recorder.capture_changed_count()); |
| 1066 EXPECT_EQ(child1_id, capture_recorder.last_gained_capture_window_id()); | 1067 EXPECT_EQ(child1_id, capture_recorder.last_gained_capture_window_id()); |
| 1067 EXPECT_EQ(0, capture_recorder.last_lost_capture_window_id()); | 1068 EXPECT_EQ(0, capture_recorder.last_lost_capture_window_id()); |
| 1068 capture_recorder.reset_capture_captured_count(); | 1069 capture_recorder.reset_capture_captured_count(); |
| 1069 | 1070 |
| 1070 // Deleting a window with capture should notify observers as well. | 1071 // Deleting a window with capture should notify observers as well. |
| 1071 child1.reset(); | 1072 child1.reset(); |
| 1072 | 1073 |
| 1073 // Deletion implicitly releases focus. | 1074 // No capture change is sent during deletion (the server side sees the window |
| 1074 ASSERT_TRUE(window_tree()->AckSingleChangeOfType( | 1075 // deletion too and resets internal state). |
| 1075 WindowTreeChangeType::CAPTURE, true)); | 1076 EXPECT_EQ( |
| 1077 0u, window_tree()->GetChangeCountForType(WindowTreeChangeType::CAPTURE)); |
| 1076 | 1078 |
| 1077 EXPECT_EQ(1, capture_recorder.capture_changed_count()); | 1079 EXPECT_EQ(1, capture_recorder.capture_changed_count()); |
| 1078 EXPECT_EQ(0, capture_recorder.last_gained_capture_window_id()); | 1080 EXPECT_EQ(0, capture_recorder.last_gained_capture_window_id()); |
| 1079 EXPECT_EQ(child1_id, capture_recorder.last_lost_capture_window_id()); | 1081 EXPECT_EQ(child1_id, capture_recorder.last_lost_capture_window_id()); |
| 1080 capture_recorder.reset_capture_captured_count(); | 1082 capture_recorder.reset_capture_captured_count(); |
| 1081 | 1083 |
| 1082 // Changes originating from server should notify observers too. | 1084 // Changes originating from server should notify observers too. |
| 1083 window_tree_client()->OnCaptureChanged(server_id(&child2), 0); | 1085 window_tree_client()->OnCaptureChanged(server_id(&child2), 0); |
| 1084 EXPECT_EQ(1, capture_recorder.capture_changed_count()); | 1086 EXPECT_EQ(1, capture_recorder.capture_changed_count()); |
| 1085 EXPECT_EQ(child2_id, capture_recorder.last_gained_capture_window_id()); | 1087 EXPECT_EQ(child2_id, capture_recorder.last_gained_capture_window_id()); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1109 // Ack change as succeeding. | 1111 // Ack change as succeeding. |
| 1110 ASSERT_TRUE( | 1112 ASSERT_TRUE( |
| 1111 window_tree()->AckSingleChangeOfType(WindowTreeChangeType::MODAL, true)); | 1113 window_tree()->AckSingleChangeOfType(WindowTreeChangeType::MODAL, true)); |
| 1112 EXPECT_EQ(ui::MODAL_TYPE_WINDOW, window.GetProperty(client::kModalKey)); | 1114 EXPECT_EQ(ui::MODAL_TYPE_WINDOW, window.GetProperty(client::kModalKey)); |
| 1113 // There should be no more modal changes. | 1115 // There should be no more modal changes. |
| 1114 EXPECT_FALSE( | 1116 EXPECT_FALSE( |
| 1115 window_tree()->AckSingleChangeOfType(WindowTreeChangeType::MODAL, false)); | 1117 window_tree()->AckSingleChangeOfType(WindowTreeChangeType::MODAL, false)); |
| 1116 } | 1118 } |
| 1117 | 1119 |
| 1118 } // namespace aura | 1120 } // namespace aura |
| OLD | NEW |