Chromium Code Reviews| 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..b100c87c10ea1e16f9d5eeda8e0d0a86ce16e60c 100644 |
| --- a/ash/devtools/ash_devtools_unittest.cc |
| +++ b/ash/devtools/ash_devtools_unittest.cc |
| @@ -347,8 +347,10 @@ 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 = |
| + WmShell::Get()->GetPrimaryRootWindow()->GetChildren()[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* sibling_node = |
| parent_node_children->get(parent_node_children->length() - 1); |
| @@ -362,10 +364,13 @@ 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* parent_window = WmShell::Get() |
| + ->GetPrimaryRootWindow() |
| + ->GetChildren()[0] |
|
oshima
2017/04/10 19:44:11
define a utility function to get the parent window
wutao
2017/04/10 23:03:54
Done. And changed other related parts.
oshima
2017/04/11 21:48:08
Sorry if it wasn't clear. I was thinking of someth
wutao
2017/04/13 18:09:39
I changed as sadrul@ suggested. GetPrimaryRootWind
|
| + ->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 +385,14 @@ TEST_F(AshDevToolsTest, WindowReorganizedChildNodeRearranged) { |
| std::unique_ptr<ui::devtools::protocol::DOM::Node> root; |
| dom_agent()->getDocument(&root); |
| - WmWindow* root_window = WmShell::Get()->GetPrimaryRootWindow(); |
| + WmWindow* root_window = |
| + WmShell::Get()->GetPrimaryRootWindow()->GetChildren()[0]; |
| + |
| 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* 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); |
| @@ -400,7 +408,8 @@ TEST_F(AshDevToolsTest, WindowReorganizedChildNodeRearranged) { |
| } |
| TEST_F(AshDevToolsTest, WindowReorganizedChildNodeRemovedAndInserted) { |
| - WmWindow* root_window = WmShell::Get()->GetPrimaryRootWindow(); |
| + WmWindow* root_window = |
| + WmShell::Get()->GetPrimaryRootWindow()->GetChildren()[0]; |
| WmWindow* target_window = root_window->GetChildren()[1]; |
| WmWindow* parent_window = root_window->GetChildren()[0]; |
| std::unique_ptr<WindowOwner> child_owner(CreateChildWindow(parent_window)); |
| @@ -409,7 +418,8 @@ TEST_F(AshDevToolsTest, WindowReorganizedChildNodeRemovedAndInserted) { |
| // 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); |
| @@ -433,11 +443,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 = |
| + WmShell::Get()->GetPrimaryRootWindow()->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); |