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

Unified Diff: ash/devtools/ash_devtools_unittest.cc

Issue 2786563003: Add a NOT_DRAWN window in between the root_window and its children. (Closed)
Patch Set: Fix nits in patch 5. Created 3 years, 8 months 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 | « no previous file | ash/public/cpp/shell_window_ids.h » ('j') | ash/wm/root_window_layout_manager.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/devtools/ash_devtools_unittest.cc
diff --git a/ash/devtools/ash_devtools_unittest.cc b/ash/devtools/ash_devtools_unittest.cc
index c94e11d0bdcca0f308749b9e9b3997a3f6400fb5..16e087196ea37caffd42cf70289a642d95a12284 100644
--- a/ash/devtools/ash_devtools_unittest.cc
+++ b/ash/devtools/ash_devtools_unittest.cc
@@ -4,6 +4,7 @@
#include "ash/devtools/ash_devtools_css_agent.h"
#include "ash/devtools/ash_devtools_dom_agent.h"
+#include "ash/public/cpp/shell_window_ids.h"
#include "ash/root_window_controller.h"
#include "ash/test/ash_test.h"
#include "ash/wm/widget_finder.h"
@@ -177,6 +178,10 @@ void ExpectHighlighted(const gfx::Rect& bounds, int root_window_index) {
->get_color());
}
+WmWindow* GetPrimaryRootWindow() {
+ return WmShell::Get()->GetPrimaryRootWindow();
+}
+
} // namespace
class AshDevToolsTest : public AshTest {
@@ -347,8 +352,9 @@ TEST_F(AshDevToolsTest, WindowAddedChildNodeInserted) {
std::unique_ptr<ui::devtools::protocol::DOM::Node> root;
dom_agent()->getDocument(&root);
- WmWindow* parent_window = WmShell::Get()->GetPrimaryRootWindow();
- DOM::Node* parent_node = root->getChildren(nullptr)->get(0);
+ WmWindow* root_window = GetPrimaryRootWindow();
+ WmWindow* parent_window = root_window->GetChildren()[0];
+ DOM::Node* parent_node = FindInRoot(parent_window, root.get());
Array<DOM::Node>* parent_node_children = parent_node->getChildren(nullptr);
DOM::Node* sibling_node =
parent_node_children->get(parent_node_children->length() - 1);
@@ -362,10 +368,12 @@ TEST_F(AshDevToolsTest, WindowDestroyedChildNodeRemoved) {
std::unique_ptr<ui::devtools::protocol::DOM::Node> root;
dom_agent()->getDocument(&root);
- WmWindow* parent_window =
- WmShell::Get()->GetPrimaryRootWindow()->GetChildren()[0];
+ WmWindow* root_window = GetPrimaryRootWindow();
+ WmWindow* rotation_window = root_window->GetChildren()[0];
+ WmWindow* parent_window = rotation_window->GetChildren()[0];
WmWindow* child_window = parent_window->GetChildren()[0];
- DOM::Node* root_node = root->getChildren(nullptr)->get(0);
+ DOM::Node* root_node =
+ root->getChildren(nullptr)->get(0)->getChildren(nullptr)->get(0);
DOM::Node* parent_node = root_node->getChildren(nullptr)->get(0);
DOM::Node* child_node = parent_node->getChildren(nullptr)->get(0);
@@ -380,11 +388,13 @@ TEST_F(AshDevToolsTest, WindowReorganizedChildNodeRearranged) {
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);
+ WmWindow* root_window = GetPrimaryRootWindow();
+ WmWindow* rotation_window = root_window->GetChildren()[0];
+ WmWindow* parent_window = rotation_window->GetChildren()[0];
+ WmWindow* target_window = rotation_window->GetChildren()[1];
+ WmWindow* child_window = parent_window->GetChildren()[0];
+ DOM::Node* root_node =
+ root->getChildren(nullptr)->get(0)->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);
@@ -392,6 +402,7 @@ TEST_F(AshDevToolsTest, WindowReorganizedChildNodeRearranged) {
target_node_children->get(target_node_children->length() - 1);
DOM::Node* child_node = parent_node->getChildren(nullptr)->get(0);
+ Compare(parent_window, parent_node);
Compare(target_window, target_node);
Compare(child_window, child_node);
target_window->AddChild(child_window);
@@ -400,17 +411,18 @@ TEST_F(AshDevToolsTest, WindowReorganizedChildNodeRearranged) {
}
TEST_F(AshDevToolsTest, WindowReorganizedChildNodeRemovedAndInserted) {
- WmWindow* root_window = WmShell::Get()->GetPrimaryRootWindow();
- WmWindow* target_window = root_window->GetChildren()[1];
- WmWindow* parent_window = root_window->GetChildren()[0];
+ WmWindow* root_window = GetPrimaryRootWindow();
+ WmWindow* rotation_window = root_window->GetChildren()[0];
+ WmWindow* parent_window = rotation_window->GetChildren()[0];
+ WmWindow* target_window = rotation_window->GetChildren()[1];
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* root_node =
+ root->getChildren(nullptr)->get(0)->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);
@@ -420,6 +432,7 @@ TEST_F(AshDevToolsTest, WindowReorganizedChildNodeRemovedAndInserted) {
DOM::Node* child_node =
parent_node_children->get(parent_node_children->length() - 1);
+ Compare(parent_window, parent_node);
Compare(target_window, target_node);
Compare(child_window, child_node);
parent_window->RemoveChild(child_window);
@@ -433,11 +446,13 @@ TEST_F(AshDevToolsTest, WindowStackingChangedChildNodeRemovedAndInserted) {
std::unique_ptr<ui::devtools::protocol::DOM::Node> root;
dom_agent()->getDocument(&root);
- WmWindow* parent_window = WmShell::Get()->GetPrimaryRootWindow();
+ WmWindow* root_window = GetPrimaryRootWindow();
+ WmWindow* parent_window = root_window->GetChildren()[0];
WmWindow* child_window = parent_window->GetChildren()[0];
WmWindow* target_window = parent_window->GetChildren()[1];
- DOM::Node* parent_node = root->getChildren(nullptr)->get(0);
+ DOM::Node* parent_node =
+ root->getChildren(nullptr)->get(0)->getChildren(nullptr)->get(0);
Array<DOM::Node>* parent_node_children = parent_node->getChildren(nullptr);
DOM::Node* child_node = parent_node_children->get(0);
DOM::Node* sibling_node = parent_node_children->get(1);
« no previous file with comments | « no previous file | ash/public/cpp/shell_window_ids.h » ('j') | ash/wm/root_window_layout_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698