| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/test/base/ui_test_utils.h" | 5 #include "chrome/test/base/ui_test_utils.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 iter = GTK_CONTAINER(iter)->focus_child; | 32 iter = GTK_CONTAINER(iter)->focus_child; |
| 33 } | 33 } |
| 34 | 34 |
| 35 return false; | 35 return false; |
| 36 } | 36 } |
| 37 } // namespace | 37 } // namespace |
| 38 | 38 |
| 39 bool IsViewFocused(const Browser* browser, ViewID vid) { | 39 bool IsViewFocused(const Browser* browser, ViewID vid) { |
| 40 BrowserWindow* browser_window = browser->window(); | 40 BrowserWindow* browser_window = browser->window(); |
| 41 DCHECK(browser_window); | 41 DCHECK(browser_window); |
| 42 gfx::NativeWindow window = browser_window->GetNativeHandle(); | 42 gfx::NativeWindow window = browser_window->GetNativeWindow(); |
| 43 DCHECK(window); | 43 DCHECK(window); |
| 44 GtkWidget* widget = ViewIDUtil::GetWidget(GTK_WIDGET(window), vid); | 44 GtkWidget* widget = ViewIDUtil::GetWidget(GTK_WIDGET(window), vid); |
| 45 DCHECK(widget); | 45 DCHECK(widget); |
| 46 return IsWidgetInFocusChain(GTK_WIDGET(window), widget); | 46 return IsWidgetInFocusChain(GTK_WIDGET(window), widget); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void ClickOnView(const Browser* browser, ViewID vid) { | 49 void ClickOnView(const Browser* browser, ViewID vid) { |
| 50 BrowserWindow* browser_window = browser->window(); | 50 BrowserWindow* browser_window = browser->window(); |
| 51 DCHECK(browser_window); | 51 DCHECK(browser_window); |
| 52 gfx::NativeWindow window = browser_window->GetNativeHandle(); | 52 gfx::NativeWindow window = browser_window->GetNativeWindow(); |
| 53 DCHECK(window); | 53 DCHECK(window); |
| 54 GtkWidget* view = ViewIDUtil::GetWidget(GTK_WIDGET(window), vid); | 54 GtkWidget* view = ViewIDUtil::GetWidget(GTK_WIDGET(window), vid); |
| 55 DCHECK(view); | 55 DCHECK(view); |
| 56 MoveMouseToCenterAndPress( | 56 MoveMouseToCenterAndPress( |
| 57 view, | 57 view, |
| 58 ui_controls::LEFT, | 58 ui_controls::LEFT, |
| 59 ui_controls::DOWN | ui_controls::UP, | 59 ui_controls::DOWN | ui_controls::UP, |
| 60 MessageLoop::QuitClosure()); | 60 MessageLoop::QuitClosure()); |
| 61 RunMessageLoop(); | 61 RunMessageLoop(); |
| 62 } | 62 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 76 int state, | 76 int state, |
| 77 const base::Closure& task) { | 77 const base::Closure& task) { |
| 78 gfx::Rect bounds = ui::GetWidgetScreenBounds(widget); | 78 gfx::Rect bounds = ui::GetWidgetScreenBounds(widget); |
| 79 ui_controls::SendMouseMoveNotifyWhenDone( | 79 ui_controls::SendMouseMoveNotifyWhenDone( |
| 80 bounds.x() + bounds.width() / 2, | 80 bounds.x() + bounds.width() / 2, |
| 81 bounds.y() + bounds.height() / 2, | 81 bounds.y() + bounds.height() / 2, |
| 82 base::Bind(&internal::ClickTask, button, state, task)); | 82 base::Bind(&internal::ClickTask, button, state, task)); |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace ui_test_utils | 85 } // namespace ui_test_utils |
| OLD | NEW |