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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_unittest.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: Rebase. 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
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 #import <ApplicationServices/ApplicationServices.h> 5 #import <ApplicationServices/ApplicationServices.h>
6 #import <Cocoa/Cocoa.h> 6 #import <Cocoa/Cocoa.h>
7 7
8 #include "base/mac/foundation_util.h" 8 #include "base/mac/foundation_util.h"
9 #include "base/mac/scoped_nsobject.h" 9 #include "base/mac/scoped_nsobject.h"
10 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" 10 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
11 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" 11 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h"
12 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" 12 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h"
13 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" 13 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h"
14 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_unittest_h elper.h" 14 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_unittest_h elper.h"
15 #import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h" 15 #import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h"
16 #include "grit/theme_resources.h" 16 #include "grit/theme_resources.h"
17 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 #import "testing/gtest_mac.h" 19 #import "testing/gtest_mac.h"
20 #include "testing/platform_test.h" 20 #include "testing/platform_test.h"
21 #include "ui/base/cocoa/cocoa_base_utils.h"
21 22
22 using ::testing::A; 23 using ::testing::A;
23 using ::testing::InSequence; 24 using ::testing::InSequence;
24 using ::testing::Return; 25 using ::testing::Return;
25 using ::testing::ReturnArg; 26 using ::testing::ReturnArg;
26 using ::testing::StrictMock; 27 using ::testing::StrictMock;
27 using ::testing::_; 28 using ::testing::_;
28 29
29 namespace { 30 namespace {
30 31
(...skipping 12 matching lines...) Expand all
43 44
44 // Create an event of the indicated |type| at |point| within |view|. 45 // Create an event of the indicated |type| at |point| within |view|.
45 // TODO(shess): Would be nice to have a MockApplication which provided 46 // TODO(shess): Would be nice to have a MockApplication which provided
46 // nifty accessors to create these things and inject them. It could 47 // nifty accessors to create these things and inject them. It could
47 // even provide functions for "Click and drag mouse from point A to 48 // even provide functions for "Click and drag mouse from point A to
48 // point B". 49 // point B".
49 NSEvent* Event(NSView* view, const NSPoint point, const NSEventType type, 50 NSEvent* Event(NSView* view, const NSPoint point, const NSEventType type,
50 const NSUInteger clickCount) { 51 const NSUInteger clickCount) {
51 NSWindow* window([view window]); 52 NSWindow* window([view window]);
52 const NSPoint locationInWindow([view convertPoint:point toView:nil]); 53 const NSPoint locationInWindow([view convertPoint:point toView:nil]);
53 const NSPoint location([window convertBaseToScreen:locationInWindow]); 54 const NSPoint location =
55 ui::ConvertPointFromWindowToScreen(window, locationInWindow);
54 return [NSEvent mouseEventWithType:type 56 return [NSEvent mouseEventWithType:type
55 location:location 57 location:location
56 modifierFlags:0 58 modifierFlags:0
57 timestamp:0 59 timestamp:0
58 windowNumber:[window windowNumber] 60 windowNumber:[window windowNumber]
59 context:nil 61 context:nil
60 eventNumber:eventNumber++ 62 eventNumber:eventNumber++
61 clickCount:clickCount 63 clickCount:clickCount
62 pressure:0.0]; 64 pressure:0.0];
63 } 65 }
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 base::scoped_nsobject<AutocompleteTextField> pin([field_ retain]); 900 base::scoped_nsobject<AutocompleteTextField> pin([field_ retain]);
899 [field_ removeFromSuperview]; 901 [field_ removeFromSuperview];
900 [test_window() resignKeyWindow]; 902 [test_window() resignKeyWindow];
901 903
902 [[test_window() contentView] addSubview:field_]; 904 [[test_window() contentView] addSubview:field_];
903 EXPECT_CALL(field_observer_, ClosePopup()); 905 EXPECT_CALL(field_observer_, ClosePopup());
904 [test_window() resignKeyWindow]; 906 [test_window() resignKeyWindow];
905 } 907 }
906 908
907 } // namespace 909 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698