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

Side by Side Diff: chrome/test/base/interactive_test_utils_mac.mm

Issue 534993002: Introduce ui_test_utils::FocusView and de-flake OmniboxViewTest.BeginningShownAfterBlur (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Spel more gooder Created 6 years, 3 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
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 <Carbon/Carbon.h> 7 #include <Carbon/Carbon.h>
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 DCHECK(window); 70 DCHECK(window);
71 NSView* view = view_id_util::GetView(window, vid); 71 NSView* view = view_id_util::GetView(window, vid);
72 DCHECK(view); 72 DCHECK(view);
73 MoveMouseToNSViewCenterAndPress( 73 MoveMouseToNSViewCenterAndPress(
74 view, 74 view,
75 ui_controls::LEFT, 75 ui_controls::LEFT,
76 ui_controls::DOWN | ui_controls::UP, 76 ui_controls::DOWN | ui_controls::UP,
77 base::MessageLoop::QuitClosure()); 77 base::MessageLoop::QuitClosure());
78 content::RunMessageLoop(); 78 content::RunMessageLoop();
79 } 79 }
80 void FocusView(const Browser* browser, ViewID vid) {
msw 2014/09/03 18:21:24 nit: blank line above.
tapted 2014/09/05 13:01:13 Done.
81 NSWindow* window = browser->window()->GetNativeWindow();
82 DCHECK(window);
83 NSView* view = view_id_util::GetView(window, vid);
84 DCHECK(view);
85 [window makeFirstResponder:view];
86 }
80 87
81 void HideNativeWindow(gfx::NativeWindow window) { 88 void HideNativeWindow(gfx::NativeWindow window) {
82 [window orderOut:nil]; 89 [window orderOut:nil];
83 } 90 }
84 91
85 bool ShowAndFocusNativeWindow(gfx::NativeWindow window) { 92 bool ShowAndFocusNativeWindow(gfx::NativeWindow window) {
86 // Make sure an unbundled program can get the input focus. 93 // Make sure an unbundled program can get the input focus.
87 ProcessSerialNumber psn = { 0, kCurrentProcess }; 94 ProcessSerialNumber psn = { 0, kCurrentProcess };
88 TransformProcessType(&psn,kProcessTransformToForegroundApplication); 95 TransformProcessType(&psn,kProcessTransformToForegroundApplication);
89 SetFrontProcess(&psn); 96 SetFrontProcess(&psn);
90 97
91 [window makeKeyAndOrderFront:nil]; 98 [window makeKeyAndOrderFront:nil];
92 return true; 99 return true;
93 } 100 }
94 101
95 } // namespace ui_test_utils 102 } // namespace ui_test_utils
OLDNEW
« no previous file with comments | « chrome/test/base/interactive_test_utils.h ('k') | chrome/test/base/interactive_test_utils_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698