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 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "chrome/browser/automation/ui_controls.h" | 9 #include "chrome/browser/automation/ui_controls.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/browser_window.h" | 11 #include "chrome/browser/ui/browser_window.h" |
12 #include "chrome/browser/ui/views/frame/browser_view.h" | 12 #include "chrome/browser/ui/views/frame/browser_view.h" |
13 #include "views/focus/focus_manager.h" | 13 #include "ui/views/focus/focus_manager.h" |
14 | 14 |
15 namespace ui_test_utils { | 15 namespace ui_test_utils { |
16 | 16 |
17 bool IsViewFocused(const Browser* browser, ViewID vid) { | 17 bool IsViewFocused(const Browser* browser, ViewID vid) { |
18 BrowserWindow* browser_window = browser->window(); | 18 BrowserWindow* browser_window = browser->window(); |
19 DCHECK(browser_window); | 19 DCHECK(browser_window); |
20 gfx::NativeWindow window = browser_window->GetNativeHandle(); | 20 gfx::NativeWindow window = browser_window->GetNativeHandle(); |
21 DCHECK(window); | 21 DCHECK(window); |
22 const views::Widget* widget = | 22 const views::Widget* widget = |
23 views::Widget::GetTopLevelWidgetForNativeView(window); | 23 views::Widget::GetTopLevelWidgetForNativeView(window); |
(...skipping 28 matching lines...) Expand all Loading... |
52 // using Windows API. | 52 // using Windows API. |
53 ::ShowWindow(window, SW_SHOW); | 53 ::ShowWindow(window, SW_SHOW); |
54 | 54 |
55 // ShowWindow does not necessarily activate the window. In particular if a | 55 // ShowWindow does not necessarily activate the window. In particular if a |
56 // window from another app is the foreground window then the request to | 56 // window from another app is the foreground window then the request to |
57 // activate the window fails. See SetForegroundWindow for details. | 57 // activate the window fails. See SetForegroundWindow for details. |
58 return GetForegroundWindow() == window; | 58 return GetForegroundWindow() == window; |
59 } | 59 } |
60 | 60 |
61 } // namespace ui_test_utils | 61 } // namespace ui_test_utils |
OLD | NEW |