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 "services/ui/public/cpp/window_tree_client.h" | 5 #include "services/ui/public/cpp/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" | |
12 #include "services/ui/common/util.h" | 11 #include "services/ui/common/util.h" |
13 #include "services/ui/public/cpp/input_event_handler.h" | 12 #include "services/ui/public/cpp/input_event_handler.h" |
14 #include "services/ui/public/cpp/property_type_converters.h" | 13 #include "services/ui/public/cpp/property_type_converters.h" |
15 #include "services/ui/public/cpp/tests/test_window.h" | 14 #include "services/ui/public/cpp/tests/test_window.h" |
16 #include "services/ui/public/cpp/tests/test_window_tree.h" | 15 #include "services/ui/public/cpp/tests/test_window_tree.h" |
17 #include "services/ui/public/cpp/tests/window_tree_client_private.h" | 16 #include "services/ui/public/cpp/tests/window_tree_client_private.h" |
18 #include "services/ui/public/cpp/window.h" | 17 #include "services/ui/public/cpp/window.h" |
19 #include "services/ui/public/cpp/window_observer.h" | 18 #include "services/ui/public/cpp/window_observer.h" |
20 #include "services/ui/public/cpp/window_private.h" | 19 #include "services/ui/public/cpp/window_private.h" |
21 #include "services/ui/public/cpp/window_property.h" | 20 #include "services/ui/public/cpp/window_property.h" |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 uint32_t property_in_flight_change_id; | 766 uint32_t property_in_flight_change_id; |
768 ASSERT_TRUE( | 767 ASSERT_TRUE( |
769 setup.window_tree()->GetAndClearChangeId(&property_in_flight_change_id)); | 768 setup.window_tree()->GetAndClearChangeId(&property_in_flight_change_id)); |
770 EXPECT_NE(bounds_in_flight_change_id, property_in_flight_change_id); | 769 EXPECT_NE(bounds_in_flight_change_id, property_in_flight_change_id); |
771 | 770 |
772 // Ack the new window top level window. Vis and bounds shouldn't change. | 771 // Ack the new window top level window. Vis and bounds shouldn't change. |
773 mojom::WindowDataPtr data = mojom::WindowData::New(); | 772 mojom::WindowDataPtr data = mojom::WindowData::New(); |
774 data->window_id = server_id(root2); | 773 data->window_id = server_id(root2); |
775 data->bounds.SetRect(1, 2, 3, 4); | 774 data->bounds.SetRect(1, 2, 3, 4); |
776 data->visible = true; | 775 data->visible = true; |
| 776 constexpr char kXxName[] = "server_xx"; |
777 data->properties["xx"] = | 777 data->properties["xx"] = |
778 mojo::Array<uint8_t>::From(std::string("server_xx")).PassStorage(); | 778 std::vector<uint8_t>(kXxName, kXxName + strlen(kXxName)); |
| 779 constexpr char kYyName[] = "server_yy"; |
779 data->properties["yy"] = | 780 data->properties["yy"] = |
780 mojo::Array<uint8_t>::From(std::string("server_yy")).PassStorage(); | 781 std::vector<uint8_t>(kYyName, kYyName + strlen(kYyName)); |
781 const int64_t display_id = 1; | 782 const int64_t display_id = 1; |
782 setup.window_tree_client()->OnTopLevelCreated( | 783 setup.window_tree_client()->OnTopLevelCreated( |
783 new_window_in_flight_change_id, std::move(data), display_id, true); | 784 new_window_in_flight_change_id, std::move(data), display_id, true); |
784 | 785 |
785 // The only value that should take effect is the property for 'yy' as it was | 786 // The only value that should take effect is the property for 'yy' as it was |
786 // not in flight. | 787 // not in flight. |
787 EXPECT_TRUE(WindowPrivate(root2).parent_drawn()); | 788 EXPECT_TRUE(WindowPrivate(root2).parent_drawn()); |
788 EXPECT_FALSE(root2->visible()); | 789 EXPECT_FALSE(root2->visible()); |
789 EXPECT_EQ(1, root2->display_id()); | 790 EXPECT_EQ(1, root2->display_id()); |
790 EXPECT_EQ(gfx::Rect(5, 6, 7, 8), root2->bounds()); | 791 EXPECT_EQ(gfx::Rect(5, 6, 7, 8), root2->bounds()); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 | 1081 |
1081 // Changes originating from server should notify observers too. | 1082 // Changes originating from server should notify observers too. |
1082 WindowTreeClientPrivate(setup.client()).CallOnCaptureChanged(child2, nullptr); | 1083 WindowTreeClientPrivate(setup.client()).CallOnCaptureChanged(child2, nullptr); |
1083 EXPECT_EQ(1, capture_recorder.capture_changed_count()); | 1084 EXPECT_EQ(1, capture_recorder.capture_changed_count()); |
1084 EXPECT_EQ(child2_id, capture_recorder.last_gained_capture_window_id()); | 1085 EXPECT_EQ(child2_id, capture_recorder.last_gained_capture_window_id()); |
1085 EXPECT_EQ(0, capture_recorder.last_lost_capture_window_id()); | 1086 EXPECT_EQ(0, capture_recorder.last_lost_capture_window_id()); |
1086 capture_recorder.reset_capture_captured_count(); | 1087 capture_recorder.reset_capture_captured_count(); |
1087 } | 1088 } |
1088 | 1089 |
1089 } // namespace ui | 1090 } // namespace ui |
OLD | NEW |