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

Side by Side Diff: chrome/test/base/interactive_test_utils_win.cc

Issue 1698123003: Remove HostDesktopType from interactive_test_utils_win (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-23
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/interactive_test_utils.h" 5 #include "chrome/test/base/interactive_test_utils.h"
6 6
7 #include <Psapi.h> 7 #include <Psapi.h>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "chrome/browser/ui/host_desktop.h"
15 #include "chrome/test/base/interactive_test_utils_aura.h" 14 #include "chrome/test/base/interactive_test_utils_aura.h"
16 #include "ui/aura/window_tree_host.h" 15 #include "ui/aura/window_tree_host.h"
17 #include "ui/base/test/ui_controls.h" 16 #include "ui/base/test/ui_controls.h"
18 #include "ui/base/win/foreground_helper.h" 17 #include "ui/base/win/foreground_helper.h"
19 #include "ui/views/focus/focus_manager.h" 18 #include "ui/views/focus/focus_manager.h"
20 19
21 namespace ui_test_utils { 20 namespace ui_test_utils {
22 21
23 void HideNativeWindow(gfx::NativeWindow window) { 22 void HideNativeWindow(gfx::NativeWindow window) {
24 if (chrome::GetHostDesktopTypeForNativeWindow(window) == 23 #if defined(USE_ASH)
25 chrome::HOST_DESKTOP_TYPE_ASH) { 24 HideNativeWindowAura(window);
26 HideNativeWindowAura(window); 25 return;
27 return; 26 #endif // USE_ASH
sky 2016/02/16 02:59:50 #else here and below.
scottmg 2016/02/17 05:36:32 Done here, one below wasn't a return, just ash-spe
28 }
29 HWND hwnd = window->GetHost()->GetAcceleratedWidget(); 27 HWND hwnd = window->GetHost()->GetAcceleratedWidget();
30 ::ShowWindow(hwnd, SW_HIDE); 28 ::ShowWindow(hwnd, SW_HIDE);
31 } 29 }
32 30
33 bool ShowAndFocusNativeWindow(gfx::NativeWindow window) { 31 bool ShowAndFocusNativeWindow(gfx::NativeWindow window) {
34 if (chrome::GetHostDesktopTypeForNativeWindow(window) == 32 #if defined(USE_ASH)
35 chrome::HOST_DESKTOP_TYPE_ASH) 33 ShowAndFocusNativeWindowAura(window);
36 ShowAndFocusNativeWindowAura(window); 34 #endif // USE_ASH
37 window->Show(); 35 window->Show();
38 // Always make sure the window hosting ash is visible and focused. 36 // Always make sure the window hosting ash is visible and focused.
39 HWND hwnd = window->GetHost()->GetAcceleratedWidget(); 37 HWND hwnd = window->GetHost()->GetAcceleratedWidget();
40 38
41 ::ShowWindow(hwnd, SW_SHOW); 39 ::ShowWindow(hwnd, SW_SHOW);
42 40
43 if (GetForegroundWindow() != hwnd) { 41 if (GetForegroundWindow() != hwnd) {
44 VLOG(1) << "Forcefully refocusing front window"; 42 VLOG(1) << "Forcefully refocusing front window";
45 ui::ForegroundHelper::SetForeground(hwnd); 43 ui::ForegroundHelper::SetForeground(hwnd);
46 } 44 }
(...skipping 20 matching lines...) Expand all
67 } 65 }
68 } 66 }
69 GetWindowText(foreground_window, window_title, arraysize(window_title)); 67 GetWindowText(foreground_window, window_title, arraysize(window_title));
70 LOG(ERROR) << "ShowAndFocusNativeWindow failed. foreground window: " 68 LOG(ERROR) << "ShowAndFocusNativeWindow failed. foreground window: "
71 << foreground_window << ", title: " << window_title << ", path: " 69 << foreground_window << ", title: " << window_title << ", path: "
72 << path_str; 70 << path_str;
73 return false; 71 return false;
74 } 72 }
75 73
76 } // namespace ui_test_utils 74 } // namespace ui_test_utils
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698