Index: ash/devtools/ash_devtools_unittest.cc |
diff --git a/ash/devtools/ash_devtools_unittest.cc b/ash/devtools/ash_devtools_unittest.cc |
index 29d7ca1f487c60cf9b327a641cf9bb906ad2a2c5..20df5fc57748479a50ce5c3b175236b86b5901e7 100644 |
--- a/ash/devtools/ash_devtools_unittest.cc |
+++ b/ash/devtools/ash_devtools_unittest.cc |
@@ -4,6 +4,8 @@ |
#include "ash/devtools/ash_devtools_css_agent.h" |
#include "ash/devtools/ash_devtools_dom_agent.h" |
+#include "ash/devtools/ui_element.h" |
+#include "ash/devtools/window_element.h" |
#include "ash/public/cpp/shell_window_ids.h" |
#include "ash/root_window_controller.h" |
#include "ash/shell.h" |
@@ -635,6 +637,23 @@ TEST_F(AshDevToolsTest, WindowWidgetViewHighlight) { |
EXPECT_FALSE(GetHighlightingWindow(0)->IsVisible()); |
} |
+int GetNodeIdFromWindow(devtools::UIElement* ui_element, WmWindow* window) { |
+ for (auto* child : ui_element->GetChildren()) { |
+ if (child->GetType() == devtools::UIElementType::WINDOW && |
+ static_cast<devtools::WindowElement*>(child)->window() == window) { |
+ return child->GetNodeId(); |
+ } |
+ } |
+ for (auto* child : ui_element->GetChildren()) { |
+ if (child->GetType() == devtools::UIElementType::WINDOW) { |
+ int node_id = GetNodeIdFromWindow(child, window); |
+ if (node_id > 0) |
+ return node_id; |
+ } |
+ } |
+ return 0; |
+} |
+ |
TEST_F(AshDevToolsTest, MultipleDisplayHighlight) { |
UpdateDisplay("300x400,500x500"); |
@@ -647,12 +666,14 @@ TEST_F(AshDevToolsTest, MultipleDisplayHighlight) { |
dom_agent()->getDocument(&root); |
EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
- HighlightNode(dom_agent()->GetNodeIdFromWindow(window)); |
+ HighlightNode( |
+ GetNodeIdFromWindow(dom_agent()->GetWindowElementRoot(), window)); |
ExpectHighlighted(window->GetBoundsInScreen(), 0); |
window->SetBoundsInScreen(gfx::Rect(500, 0, 50, 50), GetSecondaryDisplay()); |
EXPECT_EQ(root_windows[1], window->GetRootWindow()); |
- HighlightNode(dom_agent()->GetNodeIdFromWindow(window)); |
+ HighlightNode( |
+ GetNodeIdFromWindow(dom_agent()->GetWindowElementRoot(), window)); |
ExpectHighlighted(window->GetBoundsInScreen(), 1); |
} |