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

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

Issue 2495533005: Fix bug where removed (but not deleted) windows are not reflected in the tree properly (Closed)
Patch Set: Create new child instead of using existing child 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 211d12c4b5bf7f1c549804106351d1cbc32a0bfe..670ca5ff553029167789e9d4cb9f0ee036cda616 100644
--- a/ash/common/devtools/ash_devtools_unittest.cc
+++ b/ash/common/devtools/ash_devtools_unittest.cc
@@ -226,7 +226,7 @@ TEST_F(AshDevToolsTest, WindowDestroyedChildNodeRemoved) {
ExpectChildNodeRemoved(parent_node->getNodeId(), child_node->getNodeId());
}
-TEST_F(AshDevToolsTest, WindowReorganizedChildNodeRemovedAndInserted) {
+TEST_F(AshDevToolsTest, WindowReorganizedChildNodeRearranged) {
// Initialize DOMAgent
std::unique_ptr<ui::devtools::protocol::DOM::Node> root;
dom_agent()->getDocument(&root);
@@ -250,6 +250,35 @@ TEST_F(AshDevToolsTest, WindowReorganizedChildNodeRemovedAndInserted) {
ExpectChildNodeInserted(target_node->getNodeId(), sibling_node->getNodeId());
}
+TEST_F(AshDevToolsTest, WindowReorganizedChildNodeRemovedAndInserted) {
+ WmWindow* root_window = WmShell::Get()->GetPrimaryRootWindow();
+ WmWindow* target_window = root_window->GetChildren()[1];
+ WmWindow* parent_window = root_window->GetChildren()[0];
+ std::unique_ptr<WindowOwner> child_owner(CreateChildWindow(parent_window));
+ WmWindow* child_window = child_owner->window();
+
+ // Initialize DOMAgent
+ std::unique_ptr<ui::devtools::protocol::DOM::Node> root;
+ dom_agent()->getDocument(&root);
+ 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);
+ Array<DOM::Node>* parent_node_children = parent_node->getChildren(nullptr);
+ DOM::Node* child_node =
+ parent_node_children->get(parent_node_children->length() - 1);
+
+ Compare(target_window, target_node);
+ Compare(child_window, child_node);
+ parent_window->RemoveChild(child_window);
+ target_window->AddChild(child_window);
+ ExpectChildNodeRemoved(parent_node->getNodeId(), child_node->getNodeId());
+ ExpectChildNodeInserted(target_node->getNodeId(), sibling_node->getNodeId());
+}
+
TEST_F(AshDevToolsTest, WindowStackingChangedChildNodeRemovedAndInserted) {
// Initialize DOMAgent
std::unique_ptr<ui::devtools::protocol::DOM::Node> root;
« 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