OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #if !defined(USE_AURA) | |
Paweł Hajdan Jr.
2011/10/07 16:43:32
Looks like it would make more sense to extract ui_
alicet1
2011/10/07 17:22:29
I'm not sure there is enough change here currently
Paweł Hajdan Jr.
2011/10/10 19:22:56
Hey, please do. If in doubt, look at chrome/test/O
| |
7 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | |
8 | 10 |
9 #include "base/logging.h" | 11 #include "base/logging.h" |
10 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
11 #include "chrome/browser/automation/ui_controls.h" | 13 #include "chrome/browser/automation/ui_controls.h" |
12 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
14 #include "chrome/browser/ui/gtk/view_id_util.h" | 16 #include "chrome/browser/ui/gtk/view_id_util.h" |
15 #if defined(TOOLKIT_VIEWS) | 17 #if defined(TOOLKIT_VIEWS) |
16 #include "chrome/browser/ui/views/frame/browser_view.h" | 18 #include "chrome/browser/ui/views/frame/browser_view.h" |
17 #include "views/focus/focus_manager.h" | 19 #include "views/focus/focus_manager.h" |
18 #endif | 20 #endif |
19 | 21 |
20 namespace ui_test_utils { | 22 namespace ui_test_utils { |
21 | 23 |
22 #if !defined(TOOLKIT_VIEWS) | 24 #if !defined(TOOLKIT_VIEWS) && !defined(USE_AURA) |
23 namespace { | 25 namespace { |
24 | 26 |
25 // Check if the focused widget for |root| is |target| or a child of |target|. | 27 // Check if the focused widget for |root| is |target| or a child of |target|. |
26 static bool IsWidgetInFocusChain(GtkWidget* root, GtkWidget* target) { | 28 static bool IsWidgetInFocusChain(GtkWidget* root, GtkWidget* target) { |
27 GtkWidget* iter = root; | 29 GtkWidget* iter = root; |
28 | 30 |
29 while (iter) { | 31 while (iter) { |
30 if (iter == target) | 32 if (iter == target) |
31 return true; | 33 return true; |
32 | 34 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 DCHECK(view); | 79 DCHECK(view); |
78 ui_controls::MoveMouseToCenterAndPress( | 80 ui_controls::MoveMouseToCenterAndPress( |
79 view, | 81 view, |
80 ui_controls::LEFT, | 82 ui_controls::LEFT, |
81 ui_controls::DOWN | ui_controls::UP, | 83 ui_controls::DOWN | ui_controls::UP, |
82 new MessageLoop::QuitTask()); | 84 new MessageLoop::QuitTask()); |
83 RunMessageLoop(); | 85 RunMessageLoop(); |
84 } | 86 } |
85 | 87 |
86 void HideNativeWindow(gfx::NativeWindow window) { | 88 void HideNativeWindow(gfx::NativeWindow window) { |
89 #if !defined(USE_AURA) | |
87 gtk_widget_hide(GTK_WIDGET(window)); | 90 gtk_widget_hide(GTK_WIDGET(window)); |
91 #else | |
92 NOTIMPLEMENTED(); | |
93 #endif | |
88 } | 94 } |
89 | 95 |
90 void ShowAndFocusNativeWindow(gfx::NativeWindow window) { | 96 void ShowAndFocusNativeWindow(gfx::NativeWindow window) { |
97 #if !defined(USE_AURA) | |
91 if (gtk_window_has_toplevel_focus(GTK_WINDOW(window))) | 98 if (gtk_window_has_toplevel_focus(GTK_WINDOW(window))) |
92 return; | 99 return; |
93 | 100 |
94 gtk_window_present(GTK_WINDOW(window)); | 101 gtk_window_present(GTK_WINDOW(window)); |
102 #else | |
103 NOTIMPLEMENTED(); | |
104 #endif | |
95 } | 105 } |
96 | 106 |
97 } // namespace ui_test_utils | 107 } // namespace ui_test_utils |
OLD | NEW |