OLD | NEW |
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" |
(...skipping 23 matching lines...) Expand all Loading... |
34 virtual CGFloat GetWidthForSpace(CGFloat width) { return 20.0; } | 34 virtual CGFloat GetWidthForSpace(CGFloat width) { return 20.0; } |
35 | 35 |
36 virtual void DrawInFrame(NSRect frame, NSView* control_view) { ; } | 36 virtual void DrawInFrame(NSRect frame, NSView* control_view) { ; } |
37 MOCK_METHOD0(AcceptsMousePress, bool()); | 37 MOCK_METHOD0(AcceptsMousePress, bool()); |
38 MOCK_METHOD2(OnMousePressed, bool(NSRect frame, NSPoint location)); | 38 MOCK_METHOD2(OnMousePressed, bool(NSRect frame, NSPoint location)); |
39 MOCK_METHOD0(GetMenu, NSMenu*()); | 39 MOCK_METHOD0(GetMenu, NSMenu*()); |
40 }; | 40 }; |
41 | 41 |
42 class MockButtonDecoration : public ButtonDecoration { | 42 class MockButtonDecoration : public ButtonDecoration { |
43 public: | 43 public: |
| 44 // Note: It does not matter which images are used here - but ButtonDecoration |
| 45 // needs _some_ images to work properly. |
44 MockButtonDecoration() | 46 MockButtonDecoration() |
45 : ButtonDecoration(IMAGE_GRID(IDR_OMNIBOX_SEARCH_BUTTON), | 47 : ButtonDecoration(IMAGE_GRID(IDR_OMNIBOX_EV_BUBBLE), |
46 IDR_OMNIBOX_SEARCH_BUTTON_LOUPE, | 48 IDR_OMNIBOX_EV_BUBBLE_CENTER, |
47 IMAGE_GRID(IDR_OMNIBOX_SEARCH_BUTTON_HOVER), | 49 IMAGE_GRID(IDR_OMNIBOX_EV_BUBBLE), |
48 IDR_OMNIBOX_SEARCH_BUTTON_LOUPE, | 50 IDR_OMNIBOX_EV_BUBBLE_CENTER, |
49 IMAGE_GRID(IDR_OMNIBOX_SEARCH_BUTTON_PRESSED), | 51 IMAGE_GRID(IDR_OMNIBOX_EV_BUBBLE), |
50 IDR_OMNIBOX_SEARCH_BUTTON_LOUPE, | 52 IDR_OMNIBOX_EV_BUBBLE_CENTER, |
51 3) {} | 53 3) {} |
52 void Hide() { SetVisible(false); } | 54 void Hide() { SetVisible(false); } |
53 MOCK_METHOD2(OnMousePressed, bool(NSRect frame, NSPoint location)); | 55 MOCK_METHOD2(OnMousePressed, bool(NSRect frame, NSPoint location)); |
54 }; | 56 }; |
55 | 57 |
56 // Mock up an incrementing event number. | 58 // Mock up an incrementing event number. |
57 NSUInteger eventNumber = 0; | 59 NSUInteger eventNumber = 0; |
58 | 60 |
59 // Create an event of the indicated |type| at |point| within |view|. | 61 // Create an event of the indicated |type| at |point| within |view|. |
60 // TODO(shess): Would be nice to have a MockApplication which provided | 62 // TODO(shess): Would be nice to have a MockApplication which provided |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 base::scoped_nsobject<AutocompleteTextField> pin([field_ retain]); | 895 base::scoped_nsobject<AutocompleteTextField> pin([field_ retain]); |
894 [field_ removeFromSuperview]; | 896 [field_ removeFromSuperview]; |
895 [test_window() resignKeyWindow]; | 897 [test_window() resignKeyWindow]; |
896 | 898 |
897 [[test_window() contentView] addSubview:field_]; | 899 [[test_window() contentView] addSubview:field_]; |
898 EXPECT_CALL(field_observer_, ClosePopup()); | 900 EXPECT_CALL(field_observer_, ClosePopup()); |
899 [test_window() resignKeyWindow]; | 901 [test_window() resignKeyWindow]; |
900 } | 902 } |
901 | 903 |
902 } // namespace | 904 } // namespace |
OLD | NEW |