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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 EXPECT_EQ(gfx::Rect(), | 593 EXPECT_EQ(gfx::Rect(), |
594 *root_window()->GetProperty(client::kRestoreBoundsKey)); | 594 *root_window()->GetProperty(client::kRestoreBoundsKey)); |
595 ASSERT_TRUE(window_tree()->AckSingleChangeOfType( | 595 ASSERT_TRUE(window_tree()->AckSingleChangeOfType( |
596 WindowTreeChangeType::PROPERTY, false)); | 596 WindowTreeChangeType::PROPERTY, false)); |
597 EXPECT_EQ(example, *root_window()->GetProperty(client::kRestoreBoundsKey)); | 597 EXPECT_EQ(example, *root_window()->GetProperty(client::kRestoreBoundsKey)); |
598 } | 598 } |
599 | 599 |
600 // Verifies property setting behavior for a std::string* property. | 600 // Verifies property setting behavior for a std::string* property. |
601 TEST_F(WindowTreeClientWmTest, SetStringProperty) { | 601 TEST_F(WindowTreeClientWmTest, SetStringProperty) { |
602 std::string example = "123"; | 602 std::string example = "123"; |
603 ASSERT_EQ(nullptr, root_window()->GetProperty(client::kAppIdKey)); | 603 ASSERT_NE(nullptr, root_window()->GetProperty(client::kNameKey)); |
604 root_window()->SetProperty(client::kAppIdKey, new std::string(example)); | 604 root_window()->SetProperty(client::kNameKey, new std::string(example)); |
605 EXPECT_TRUE(root_window()->GetProperty(client::kAppIdKey)); | 605 EXPECT_TRUE(root_window()->GetProperty(client::kNameKey)); |
606 base::Optional<std::vector<uint8_t>> value = | 606 base::Optional<std::vector<uint8_t>> value = |
607 window_tree()->GetLastPropertyValue(); | 607 window_tree()->GetLastPropertyValue(); |
608 ASSERT_TRUE(value.has_value()); | 608 ASSERT_TRUE(value.has_value()); |
609 EXPECT_EQ(example, mojo::ConvertTo<std::string>(*value)); | 609 EXPECT_EQ(example, mojo::ConvertTo<std::string>(*value)); |
610 ASSERT_TRUE(window_tree()->AckSingleChangeOfType( | 610 ASSERT_TRUE(window_tree()->AckSingleChangeOfType( |
611 WindowTreeChangeType::PROPERTY, true)); | 611 WindowTreeChangeType::PROPERTY, true)); |
612 EXPECT_EQ(example, *root_window()->GetProperty(client::kAppIdKey)); | 612 EXPECT_EQ(example, *root_window()->GetProperty(client::kNameKey)); |
613 | 613 |
614 root_window()->SetProperty(client::kAppIdKey, new std::string()); | 614 root_window()->SetProperty(client::kNameKey, new std::string()); |
615 EXPECT_EQ(std::string(), *root_window()->GetProperty(client::kAppIdKey)); | 615 EXPECT_EQ(std::string(), *root_window()->GetProperty(client::kNameKey)); |
616 ASSERT_TRUE(window_tree()->AckSingleChangeOfType( | 616 ASSERT_TRUE(window_tree()->AckSingleChangeOfType( |
617 WindowTreeChangeType::PROPERTY, false)); | 617 WindowTreeChangeType::PROPERTY, false)); |
618 EXPECT_EQ(example, *root_window()->GetProperty(client::kAppIdKey)); | 618 EXPECT_EQ(example, *root_window()->GetProperty(client::kNameKey)); |
619 } | 619 } |
620 | 620 |
621 // Verifies visible is reverted if the server replied that the change failed. | 621 // Verifies visible is reverted if the server replied that the change failed. |
622 TEST_F(WindowTreeClientWmTest, SetVisibleFailed) { | 622 TEST_F(WindowTreeClientWmTest, SetVisibleFailed) { |
623 const bool original_visible = root_window()->TargetVisibility(); | 623 const bool original_visible = root_window()->TargetVisibility(); |
624 const bool new_visible = !original_visible; | 624 const bool new_visible = !original_visible; |
625 SetWindowVisibility(root_window(), new_visible); | 625 SetWindowVisibility(root_window(), new_visible); |
626 ASSERT_TRUE(window_tree()->AckSingleChangeOfType( | 626 ASSERT_TRUE(window_tree()->AckSingleChangeOfType( |
627 WindowTreeChangeType::VISIBLE, false)); | 627 WindowTreeChangeType::VISIBLE, false)); |
628 EXPECT_EQ(original_visible, root_window()->TargetVisibility()); | 628 EXPECT_EQ(original_visible, root_window()->TargetVisibility()); |
(...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2404 window_tree()->GetEventResult(event_id)); | 2404 window_tree()->GetEventResult(event_id)); |
2405 EXPECT_TRUE(window_delegate1.got_move()); | 2405 EXPECT_TRUE(window_delegate1.got_move()); |
2406 EXPECT_FALSE(window_delegate2.got_move()); | 2406 EXPECT_FALSE(window_delegate2.got_move()); |
2407 gfx::Point transformed_event_location_in_dip(event_location_in_dip.x() + 20, | 2407 gfx::Point transformed_event_location_in_dip(event_location_in_dip.x() + 20, |
2408 event_location_in_dip.y() + 30); | 2408 event_location_in_dip.y() + 30); |
2409 EXPECT_EQ(transformed_event_location_in_dip, | 2409 EXPECT_EQ(transformed_event_location_in_dip, |
2410 window_delegate1.last_event_location()); | 2410 window_delegate1.last_event_location()); |
2411 } | 2411 } |
2412 | 2412 |
2413 } // namespace aura | 2413 } // namespace aura |
OLD | NEW |