Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: ash/common/devtools/ash_devtools_unittest.cc

Issue 2476353002: Fix bug where removed (but not deleted) windows are not reflected in the tree properly (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/common/devtools/ash_devtools_unittest.cc
diff --git a/ash/common/devtools/ash_devtools_unittest.cc b/ash/common/devtools/ash_devtools_unittest.cc
index 3bd737ac2c644b629e31941b5bb42121ab8e0cbe..30addd16938ecf41535641bf29573e0ca1090659 100644
--- a/ash/common/devtools/ash_devtools_unittest.cc
+++ b/ash/common/devtools/ash_devtools_unittest.cc
@@ -232,6 +232,31 @@ TEST_F(AshDevToolsTest, WindowDestroyedChildNodeRemoved) {
ExpectChildNodeRemoved(parent_node->getNodeId(), child_node->getNodeId());
}
+TEST_F(AshDevToolsTest, WindowReorganizedChildNodeRearranged) {
+ // Initialize DOMAgent
+ std::unique_ptr<ui::devtools::protocol::DOM::Node> root;
+ dom_agent()->getDocument(&root);
+
+ WmWindow* root_window = WmShell::Get()->GetPrimaryRootWindow();
+ WmWindow* target_window = root_window->GetChildren()[1];
+ WmWindow* child_window = root_window->GetChildren()[0]->GetChildren()[0];
+
+ DOM::Node* root_node = root->getChildren(default_children)->get(0);
+ DOM::Node* parent_node = root_node->getChildren(default_children)->get(0);
+ DOM::Node* target_node = root_node->getChildren(default_children)->get(1);
+ Array<DOM::Node>* target_node_children =
+ target_node->getChildren(default_children);
+ DOM::Node* sibling_node =
+ target_node_children->get(target_node_children->length() - 1);
+ DOM::Node* child_node = parent_node->getChildren(default_children)->get(0);
+
+ Compare(target_window, target_node);
+ Compare(child_window, child_node);
+ target_window->AddChild(child_window);
+ ExpectChildNodeRemoved(parent_node->getNodeId(), child_node->getNodeId());
+ ExpectChildNodeInserted(target_node->getNodeId(), sibling_node->getNodeId());
+}
+
TEST_F(AshDevToolsTest, WindowReorganizedChildNodeRemovedAndInserted) {
// Initialize DOMAgent
std::unique_ptr<ui::devtools::protocol::DOM::Node> root;
@@ -252,6 +277,7 @@ TEST_F(AshDevToolsTest, WindowReorganizedChildNodeRemovedAndInserted) {
Compare(target_window, target_node);
Compare(child_window, child_node);
+ child_window->GetParent()->RemoveChild(child_window);
target_window->AddChild(child_window);
ExpectChildNodeRemoved(parent_node->getNodeId(), child_node->getNodeId());
ExpectChildNodeInserted(target_node->getNodeId(), sibling_node->getNodeId());

Powered by Google App Engine
This is Rietveld 408576698