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

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: Remove old_parent parameter 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
« no previous file with comments | « ash/common/devtools/ash_devtools_dom_agent.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1a79c07dc2cf5032503b3a7dfaf9103bde2a898a..2bbcacd02aca8105ab80b3e38f491a69974ee184 100644
--- a/ash/common/devtools/ash_devtools_unittest.cc
+++ b/ash/common/devtools/ash_devtools_unittest.cc
@@ -225,6 +225,30 @@ 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(nullptr)->get(0);
+ DOM::Node* parent_node = root_node->getChildren(nullptr)->get(0);
+ DOM::Node* target_node = root_node->getChildren(nullptr)->get(1);
+ Array<DOM::Node>* target_node_children = target_node->getChildren(nullptr);
+ DOM::Node* sibling_node =
+ target_node_children->get(target_node_children->length() - 1);
+ DOM::Node* child_node = parent_node->getChildren(nullptr)->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;
@@ -244,6 +268,7 @@ TEST_F(AshDevToolsTest, WindowReorganizedChildNodeRemovedAndInserted) {
Compare(target_window, target_node);
Compare(child_window, child_node);
+ child_window->GetParent()->RemoveChild(child_window);
sadrul 2016/11/10 20:25:24 Why is this necessary?
Sarmad Hashmi 2016/11/10 21:00:34 We know AddChild removes |window| from its old par
target_window->AddChild(child_window);
ExpectChildNodeRemoved(parent_node->getNodeId(), child_node->getNodeId());
ExpectChildNodeInserted(target_node->getNodeId(), sibling_node->getNodeId());
« no previous file with comments | « ash/common/devtools/ash_devtools_dom_agent.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698