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

Unified Diff: ash/devtools/ash_devtools_unittest.cc

Issue 2902063004: View shows wrong bound when it is highlighted. (Closed)
Patch Set: . Created 3 years, 7 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
Index: ash/devtools/ash_devtools_unittest.cc
diff --git a/ash/devtools/ash_devtools_unittest.cc b/ash/devtools/ash_devtools_unittest.cc
index a1ecc40126c8b139172f36b413355bd1f2e49b9a..b00172766a2e1034e3dc3986855b390d3ad9b6b8 100644
--- a/ash/devtools/ash_devtools_unittest.cc
+++ b/ash/devtools/ash_devtools_unittest.cc
@@ -5,6 +5,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/view_element.h"
+#include "ash/devtools/widget_element.h"
#include "ash/devtools/window_element.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/root_window_controller.h"
@@ -635,17 +637,38 @@ TEST_F(AshDevToolsTest, WindowWidgetViewHighlight) {
HighlightNode(window_node->getNodeId());
ExpectHighlighted(window->GetBoundsInScreen(), 0);
+ devtools::WindowElement* window_element =
+ static_cast<devtools::WindowElement*>(
+ dom_agent()->node_id_to_ui_element()[window_node->getNodeId()]);
sadrul 2017/05/25 19:07:28 Can you just use dom_agent()->GetElementFromNodeId
thanhph 2017/05/25 20:16:40 Done.
+ EXPECT_EQ(window_element->GetNodeWindowAndBounds().first, window.get());
+ EXPECT_EQ(window_element->GetNodeWindowAndBounds().second,
+ window->GetBoundsInScreen());
HideHighlight(0);
HighlightNode(widget_node->getNodeId());
ExpectHighlighted(widget->GetWindowBoundsInScreen(), 0);
+ devtools::WidgetElement* widget_element =
+ static_cast<devtools::WidgetElement*>(
+ dom_agent()->node_id_to_ui_element()[widget_node->getNodeId()]);
+ EXPECT_EQ(widget_element->GetNodeWindowAndBounds().first,
+ widget->GetNativeWindow());
+ EXPECT_EQ(widget_element->GetNodeWindowAndBounds().second,
+ widget->GetWindowBoundsInScreen());
+
HideHighlight(0);
HighlightNode(root_view_node->getNodeId());
ExpectHighlighted(root_view->GetBoundsInScreen(), 0);
+ devtools::ViewElement* view_element = static_cast<devtools::ViewElement*>(
+ dom_agent()->node_id_to_ui_element()[root_view_node->getNodeId()]);
+ EXPECT_EQ(view_element->GetNodeWindowAndBounds().first,
+ root_view->GetWidget()->GetNativeWindow());
+ EXPECT_EQ(view_element->GetNodeWindowAndBounds().second,
+ root_view->GetBoundsInScreen());
+
HideHighlight(0);
// Highlight non-existent node

Powered by Google App Engine
This is Rietveld 408576698