| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/common/devtools/ash_devtools_css_agent.h" | 5 #include "ash/common/devtools/ash_devtools_css_agent.h" |
| 6 #include "ash/common/devtools/ash_devtools_dom_agent.h" | 6 #include "ash/common/devtools/ash_devtools_dom_agent.h" |
| 7 #include "ash/common/test/ash_test.h" | 7 #include "ash/common/test/ash_test.h" |
| 8 #include "ash/common/wm_shell.h" | 8 #include "ash/common/wm_shell.h" |
| 9 #include "ash/common/wm_window.h" | 9 #include "ash/common/wm_window.h" |
| 10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 dom_agent()->getDocument(&root); | 711 dom_agent()->getDocument(&root); |
| 712 | 712 |
| 713 DOM::Node* parent_node = FindInRoot(parent_window, root.get()); | 713 DOM::Node* parent_node = FindInRoot(parent_window, root.get()); |
| 714 ASSERT_TRUE(parent_node); | 714 ASSERT_TRUE(parent_node); |
| 715 Array<DOM::Node>* parent_children = parent_node->getChildren(nullptr); | 715 Array<DOM::Node>* parent_children = parent_node->getChildren(nullptr); |
| 716 ASSERT_TRUE(parent_children); | 716 ASSERT_TRUE(parent_children); |
| 717 | 717 |
| 718 // Test different combinations on window node | 718 // Test different combinations on window node |
| 719 DOM::Node* window_node = parent_children->get(1); | 719 DOM::Node* window_node = parent_children->get(1); |
| 720 | 720 |
| 721 SetStyleTexts(window_node, "x: 25; y:35; width: 5; height: 20;", true); | 721 SetStyleTexts(window_node, |
| 722 "x: 25; y:35; width: 5; height: 20; visibility: 1;", true); |
| 722 EXPECT_EQ(gfx::Rect(25, 35, 5, 20), window->GetBounds()); | 723 EXPECT_EQ(gfx::Rect(25, 35, 5, 20), window->GetBounds()); |
| 724 EXPECT_TRUE(window->IsVisible()); |
| 723 | 725 |
| 724 SetStyleTexts(window_node, "test_nothing_happens:1;", false); | 726 SetStyleTexts(window_node, "test_nothing_happens:1;", false); |
| 725 EXPECT_EQ(gfx::Rect(25, 35, 5, 20), window->GetBounds()); // Not changed | 727 EXPECT_EQ(gfx::Rect(25, 35, 5, 20), window->GetBounds()); // Not changed |
| 726 | 728 |
| 727 SetStyleTexts(window_node, "\nheight: 10;\n ", true); | 729 SetStyleTexts(window_node, "\nheight: 10;\nvisibility: 0;\n", true); |
| 728 EXPECT_EQ(gfx::Rect(25, 35, 5, 10), window->GetBounds()); | 730 EXPECT_EQ(gfx::Rect(25, 35, 5, 10), window->GetBounds()); |
| 731 EXPECT_FALSE(window->IsVisible()); |
| 729 | 732 |
| 730 SetStyleTexts(window_node, "\nx: 10; y: 23; width: 52;\n ", true); | 733 SetStyleTexts(window_node, "\nx: 10; y: 23; width: 52;\n ", true); |
| 731 EXPECT_EQ(gfx::Rect(10, 23, 52, 10), window->GetBounds()); | 734 EXPECT_EQ(gfx::Rect(10, 23, 52, 10), window->GetBounds()); |
| 732 | 735 |
| 733 // Test different combinations on widget node | 736 // Test different combinations on widget node |
| 734 DOM::Node* widget_node = parent_children->get(0); | 737 DOM::Node* widget_node = parent_children->get(0); |
| 735 | 738 |
| 736 SetStyleTexts(widget_node, "x: 25; y:35; width: 53; height: 64;", true); | 739 SetStyleTexts(widget_node, |
| 740 "x: 25; y:35; width: 53; height: 64; visibility: 0;", true); |
| 737 EXPECT_EQ(gfx::Rect(25, 35, 53, 64), widget->GetRestoredBounds()); | 741 EXPECT_EQ(gfx::Rect(25, 35, 53, 64), widget->GetRestoredBounds()); |
| 742 EXPECT_FALSE(widget->IsVisible()); |
| 738 | 743 |
| 739 SetStyleTexts(widget_node, "test_nothing_happens:1;", false); | 744 SetStyleTexts(widget_node, "test_nothing_happens:1;", false); |
| 740 EXPECT_EQ(gfx::Rect(25, 35, 53, 64), | 745 EXPECT_EQ(gfx::Rect(25, 35, 53, 64), |
| 741 widget->GetRestoredBounds()); // Not changed | 746 widget->GetRestoredBounds()); // Not changed |
| 742 | 747 |
| 743 SetStyleTexts(widget_node, "\nheight: 123;\n ", true); | 748 SetStyleTexts(widget_node, "\nheight: 123;\nvisibility: 1;\n", true); |
| 744 EXPECT_EQ(gfx::Rect(25, 35, 53, 123), widget->GetRestoredBounds()); | 749 EXPECT_EQ(gfx::Rect(25, 35, 53, 123), widget->GetRestoredBounds()); |
| 750 EXPECT_TRUE(widget->IsVisible()); |
| 745 | 751 |
| 746 SetStyleTexts(widget_node, "\nx: 10; y: 23; width: 98;\n ", true); | 752 SetStyleTexts(widget_node, "\nx: 10; y: 23; width: 98;\n ", true); |
| 747 EXPECT_EQ(gfx::Rect(10, 23, 98, 123), widget->GetRestoredBounds()); | 753 EXPECT_EQ(gfx::Rect(10, 23, 98, 123), widget->GetRestoredBounds()); |
| 748 | 754 |
| 749 // Test different combinations on view node | 755 // Test different combinations on view node |
| 750 DOM::Node* root_view_node = widget_node->getChildren(nullptr)->get(0); | 756 DOM::Node* root_view_node = widget_node->getChildren(nullptr)->get(0); |
| 751 | 757 |
| 752 SetStyleTexts(root_view_node, "x: 25; y:35; width: 45; height: 20;", true); | 758 SetStyleTexts(root_view_node, |
| 759 "x: 25; y:35; width: 45; height: 20; visibility: 0;", true); |
| 753 EXPECT_EQ(gfx::Rect(25, 35, 45, 20), root_view->bounds()); | 760 EXPECT_EQ(gfx::Rect(25, 35, 45, 20), root_view->bounds()); |
| 761 EXPECT_FALSE(root_view->visible()); |
| 754 | 762 |
| 755 SetStyleTexts(root_view_node, "test_nothing_happens:1;", false); | 763 SetStyleTexts(root_view_node, "test_nothing_happens:1;", false); |
| 756 EXPECT_EQ(gfx::Rect(25, 35, 45, 20), root_view->bounds()); // Not changed | 764 EXPECT_EQ(gfx::Rect(25, 35, 45, 20), root_view->bounds()); // Not changed |
| 757 | 765 |
| 758 SetStyleTexts(root_view_node, "\nheight: 73;\n ", true); | 766 SetStyleTexts(root_view_node, "\nheight: 73;\n ", true); |
| 759 EXPECT_EQ(gfx::Rect(25, 35, 45, 73), root_view->bounds()); | 767 EXPECT_EQ(gfx::Rect(25, 35, 45, 73), root_view->bounds()); |
| 760 | 768 |
| 761 SetStyleTexts(root_view_node, "\nx: 10; y: 23; width: 52;\n ", true); | 769 SetStyleTexts(root_view_node, "\nx: 10; y: 23; width: 52;\nvisibility: 1;\n", |
| 770 true); |
| 762 EXPECT_EQ(gfx::Rect(10, 23, 52, 73), root_view->bounds()); | 771 EXPECT_EQ(gfx::Rect(10, 23, 52, 73), root_view->bounds()); |
| 772 EXPECT_TRUE(root_view->visible()); |
| 763 } | 773 } |
| 764 | 774 |
| 765 } // namespace ash | 775 } // namespace ash |
| OLD | NEW |