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..ea552b9f7b8c28394d1e1d26d80de39c7ff1cbd2 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* GetWindowByShellId(int id) { |
+ return WmShell::Get()->GetPrimaryRootWindow()->GetChildByShellWindowId(id); |
+} |
+ |
} // 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* parent_window = |
+ GetWindowByShellId(kShellWindowId_ScreenRotationContainer); |
+ 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); |
@@ -363,9 +369,10 @@ TEST_F(AshDevToolsTest, WindowDestroyedChildNodeRemoved) { |
dom_agent()->getDocument(&root); |
WmWindow* parent_window = |
- WmShell::Get()->GetPrimaryRootWindow()->GetChildren()[0]; |
+ GetWindowByShellId(kShellWindowId_WallpaperContainer); |
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 +387,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* target_window = |
+ GetWindowByShellId(kShellWindowId_NonLockScreenContainersContainer); |
sadrul
2017/04/13 17:09:42
These look ... weird. Can you do:
WmWindow* root_
wutao
2017/04/13 18:09:39
Done.
|
+ WmWindow* parent_window = |
+ GetWindowByShellId(kShellWindowId_WallpaperContainer); |
+ 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 +401,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 +410,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* target_window = |
+ GetWindowByShellId(kShellWindowId_NonLockScreenContainersContainer); |
+ WmWindow* parent_window = |
+ GetWindowByShellId(kShellWindowId_WallpaperContainer); |
sadrul
2017/04/13 17:09:42
As above, go to target_window and parent_window th
wutao
2017/04/13 18:09:39
Done.
|
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 +431,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 +445,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* parent_window = |
+ GetWindowByShellId(kShellWindowId_ScreenRotationContainer); |
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); |