[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / location_bar / autocomplete_text_field_unittest_helper.h
blob4ac3e5f16aed86acce94d94ee4367afcbd545a2b
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_AUTOCOMPLETE_TEXT_FIELD_UNITTEST_HELPER_H_
6 #define CHROME_BROWSER_UI_COCOA_AUTOCOMPLETE_TEXT_FIELD_UNITTEST_HELPER_H_
8 #import <Cocoa/Cocoa.h>
10 #include "base/mac/scoped_nsobject.h"
11 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h"
12 #include "testing/gmock/include/gmock/gmock.h"
14 @class AutocompleteTextFieldEditor;
16 // Return the right field editor for AutocompleteTextField instance.
18 @interface AutocompleteTextFieldWindowTestDelegate :
19 NSObject<NSWindowDelegate> {
20 base::scoped_nsobject<AutocompleteTextFieldEditor> editor_;
22 - (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)anObject;
23 @end
25 // Allow monitoring calls into AutocompleteTextField's observer.
26 // Being in a .h file with an anonymous namespace is strange, but this
27 // is here so the mock interface doesn't have to change in multiple
28 // places.
30 // Any method you add here needs a unit test. You knew that.
32 class MockAutocompleteTextFieldObserver : public AutocompleteTextFieldObserver {
33 public:
34 MockAutocompleteTextFieldObserver();
35 ~MockAutocompleteTextFieldObserver();
37 MOCK_METHOD1(SelectionRangeForProposedRange, NSRange(NSRange range));
38 MOCK_METHOD1(OnControlKeyChanged, void(bool pressed));
39 MOCK_METHOD0(CanCopy, bool());
40 MOCK_METHOD1(CopyToPasteboard, void(NSPasteboard* pboard));
41 MOCK_METHOD0(ShouldEnableShowURL, bool());
42 MOCK_METHOD0(ShowURL, void());
43 MOCK_METHOD0(OnPaste, void());
44 MOCK_METHOD0(CanPasteAndGo, bool());
45 MOCK_METHOD0(GetPasteActionStringId, int());
46 MOCK_METHOD0(OnPasteAndGo, void());
47 MOCK_METHOD0(OnFrameChanged, void());
48 MOCK_METHOD0(ClosePopup, void());
49 MOCK_METHOD0(OnDidBeginEditing, void());
50 MOCK_METHOD0(OnBeforeChange, void());
51 MOCK_METHOD0(OnDidChange, void());
52 MOCK_METHOD0(OnDidEndEditing, void());
53 MOCK_METHOD1(OnDoCommandBySelector, bool(SEL cmd));
54 MOCK_METHOD1(OnSetFocus, void(bool control_down));
55 MOCK_METHOD0(OnKillFocus, void());
56 MOCK_METHOD1(OnMouseDown, void(NSInteger button_number));
57 MOCK_METHOD0(ShouldSelectAllOnMouseDown, bool());
60 #endif // CHROME_BROWSER_UI_COCOA_AUTOCOMPLETE_TEXT_FIELD_UNITTEST_HELPER_H_