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

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

Issue 1775223002: Prepare chrome/ for compilation with OS X 10.7 deployment target. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile errors. Fix null-window error. Created 4 years, 9 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 | « chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm ('k') | 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "chrome/app/chrome_command_ids.h" 12 #include "chrome/app/chrome_command_ids.h"
13 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/browser_window.h" 14 #include "chrome/browser/ui/browser_window.h"
15 #import "chrome/browser/ui/cocoa/view_id_util.h" 15 #import "chrome/browser/ui/cocoa/view_id_util.h"
16 #include "ui/base/cocoa/cocoa_base_utils.h"
16 17
17 namespace ui_test_utils { 18 namespace ui_test_utils {
18 19
19 namespace { 20 namespace {
20 21
21 void MoveMouseToNSViewCenterAndPress( 22 void MoveMouseToNSViewCenterAndPress(
22 NSView* view, 23 NSView* view,
23 ui_controls::MouseButton button, 24 ui_controls::MouseButton button,
24 int state, 25 int state,
25 const base::Closure& task) { 26 const base::Closure& task) {
26 NSWindow* window = [view window]; 27 NSWindow* window = [view window];
27 NSScreen* screen = [window screen]; 28 NSScreen* screen = [window screen];
28 DCHECK(screen); 29 DCHECK(screen);
29 30
30 // Converts the center position of the view into the coordinates accepted 31 // Converts the center position of the view into the coordinates accepted
31 // by SendMouseMoveNotifyWhenDone() method. 32 // by SendMouseMoveNotifyWhenDone() method.
32 NSRect bounds = [view bounds]; 33 NSRect bounds = [view bounds];
33 NSPoint center = NSMakePoint(NSMidX(bounds), NSMidY(bounds)); 34 NSPoint center = NSMakePoint(NSMidX(bounds), NSMidY(bounds));
34 center = [view convertPoint:center toView:nil]; 35 center = [view convertPoint:center toView:nil];
35 center = [window convertBaseToScreen:center]; 36 center = ui::ConvertPointFromWindowToScreen(window, center);
36 center = NSMakePoint(center.x, [screen frame].size.height - center.y); 37 center = NSMakePoint(center.x, [screen frame].size.height - center.y);
37 38
38 ui_controls::SendMouseMoveNotifyWhenDone( 39 ui_controls::SendMouseMoveNotifyWhenDone(
39 center.x, center.y, 40 center.x, center.y,
40 base::Bind(&internal::ClickTask, button, state, task)); 41 base::Bind(&internal::ClickTask, button, state, task));
41 } 42 }
42 43
43 } // namespace 44 } // namespace
44 45
45 bool IsViewFocused(const Browser* browser, ViewID vid) { 46 bool IsViewFocused(const Browser* browser, ViewID vid) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 87
87 void FocusView(const Browser* browser, ViewID vid) { 88 void FocusView(const Browser* browser, ViewID vid) {
88 NSWindow* window = browser->window()->GetNativeWindow(); 89 NSWindow* window = browser->window()->GetNativeWindow();
89 DCHECK(window); 90 DCHECK(window);
90 NSView* view = view_id_util::GetView(window, vid); 91 NSView* view = view_id_util::GetView(window, vid);
91 DCHECK(view); 92 DCHECK(view);
92 [window makeFirstResponder:view]; 93 [window makeFirstResponder:view];
93 } 94 }
94 95
95 } // namespace ui_test_utils 96 } // namespace ui_test_utils
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698