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

Unified Diff: chrome/test/ui_test_utils_linux.cc

Issue 1576008: Enable interactive_ui_tests (Closed)
Patch Set: include Created 10 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 | « chrome/test/interactive_ui/view_event_test_base.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/ui_test_utils_linux.cc
diff --git a/chrome/test/ui_test_utils_linux.cc b/chrome/test/ui_test_utils_linux.cc
index ddcd1b8b4c0140d50d484a3a839b0b9a55bf585b..5878086baf0f53fdfd570cd1fcef541c95937bcf 100644
--- a/chrome/test/ui_test_utils_linux.cc
+++ b/chrome/test/ui_test_utils_linux.cc
@@ -13,12 +13,14 @@
#include "chrome/browser/automation/ui_controls.h"
#if defined(TOOLKIT_VIEWS)
#include "chrome/browser/views/frame/browser_view.h"
+#include "views/focus/focus_manager.h"
#endif
#include "chrome/browser/gtk/view_id_util.h"
namespace ui_test_utils {
+#if !defined(TOOLKIT_VIEWS)
namespace {
// Check if the focused widget for |root| is |target| or a child of |target|.
@@ -39,15 +41,27 @@ static bool IsWidgetInFocusChain(GtkWidget* root, GtkWidget* target) {
}
} // namespace
+#endif
bool IsViewFocused(const Browser* browser, ViewID vid) {
BrowserWindow* browser_window = browser->window();
DCHECK(browser_window);
+#if defined(TOOLKIT_VIEWS)
+ gfx::NativeWindow window = browser_window->GetNativeHandle();
+ DCHECK(window);
+ views::FocusManager* focus_manager =
+ views::FocusManager::GetFocusManagerForNativeView(
+ GTK_WIDGET(window));
+ DCHECK(focus_manager);
+ return focus_manager->GetFocusedView() &&
+ focus_manager->GetFocusedView()->GetID() == vid;
+#else
gfx::NativeWindow window = browser_window->GetNativeHandle();
DCHECK(window);
GtkWidget* widget = ViewIDUtil::GetWidget(GTK_WIDGET(window), vid);
DCHECK(widget);
return IsWidgetInFocusChain(GTK_WIDGET(window), widget);
+#endif
}
void ClickOnView(const Browser* browser, ViewID vid) {
« no previous file with comments | « chrome/test/interactive_ui/view_event_test_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698