Home | History | Annotate | Download | only in autofill
      1 // Copyright 2013 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.
      4 
      5 #ifndef CHROME_BROWSER_UI_AUTOFILL_MOCK_AUTOFILL_DIALOG_VIEW_DELEGATE_H_
      6 #define CHROME_BROWSER_UI_AUTOFILL_MOCK_AUTOFILL_DIALOG_VIEW_DELEGATE_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h"
     10 #include "testing/gmock/include/gmock/gmock.h"
     11 #include "ui/gfx/range/range.h"
     12 
     13 namespace autofill {
     14 
     15 class MockAutofillDialogViewDelegate : public AutofillDialogViewDelegate {
     16  public:
     17   MockAutofillDialogViewDelegate();
     18   virtual ~MockAutofillDialogViewDelegate();
     19 
     20   MOCK_CONST_METHOD0(DialogTitle, base::string16());
     21   MOCK_CONST_METHOD0(AccountChooserText, base::string16());
     22   MOCK_CONST_METHOD0(SignInLinkText, base::string16());
     23   MOCK_CONST_METHOD0(SpinnerText, base::string16());
     24   MOCK_CONST_METHOD0(EditSuggestionText, base::string16());
     25   MOCK_CONST_METHOD0(CancelButtonText, base::string16());
     26   MOCK_CONST_METHOD0(ConfirmButtonText, base::string16());
     27   MOCK_CONST_METHOD0(SaveLocallyText, base::string16());
     28   MOCK_CONST_METHOD0(SaveLocallyTooltip, base::string16());
     29   MOCK_METHOD0(LegalDocumentsText, base::string16());
     30   MOCK_CONST_METHOD0(ShouldShowSpinner, bool());
     31   MOCK_CONST_METHOD0(ShouldShowAccountChooser, bool());
     32   MOCK_CONST_METHOD0(ShouldShowSignInWebView, bool());
     33   MOCK_CONST_METHOD0(SignInUrl, GURL());
     34   MOCK_CONST_METHOD0(ShouldOfferToSaveInChrome, bool());
     35   MOCK_CONST_METHOD0(ShouldSaveInChrome, bool());
     36   MOCK_METHOD0(MenuModelForAccountChooser, ui::MenuModel*());
     37   MOCK_METHOD0(AccountChooserImage, gfx::Image());
     38   MOCK_CONST_METHOD0(ShouldShowProgressBar, bool());
     39   MOCK_CONST_METHOD0(ButtonStripImage, gfx::Image());
     40   MOCK_CONST_METHOD0(GetDialogButtons, int());
     41   MOCK_CONST_METHOD1(IsDialogButtonEnabled, bool(ui::DialogButton button));
     42   MOCK_METHOD0(GetDialogOverlay, DialogOverlayState());
     43   MOCK_METHOD0(LegalDocumentLinks, const std::vector<gfx::Range>&());
     44   MOCK_CONST_METHOD1(SectionIsActive, bool(DialogSection));
     45   MOCK_CONST_METHOD1(RequestedFieldsForSection,
     46                      const DetailInputs&(DialogSection));
     47   MOCK_METHOD1(ComboboxModelForAutofillType,
     48                ui::ComboboxModel*(ServerFieldType));
     49   MOCK_METHOD1(MenuModelForSection, ui::MenuModel*(DialogSection));
     50   MOCK_CONST_METHOD1(LabelForSection, base::string16(DialogSection section));
     51   MOCK_METHOD1(SuggestionStateForSection, SuggestionState(DialogSection));
     52   MOCK_METHOD1(EditClickedForSection, void(DialogSection section));
     53   MOCK_METHOD1(EditCancelledForSection, void(DialogSection section));
     54   MOCK_CONST_METHOD1(IconsForFields, FieldIconMap(const FieldValueMap&));
     55   MOCK_CONST_METHOD1(FieldControlsIcons, bool(ServerFieldType));
     56   MOCK_CONST_METHOD1(TooltipForField, base::string16(ServerFieldType));
     57   MOCK_METHOD2(InputIsEditable, bool(const DetailInput& input,
     58                                      DialogSection section));
     59   MOCK_METHOD3(InputValidityMessage,
     60       base::string16(DialogSection, ServerFieldType, const base::string16&));
     61   MOCK_METHOD2(InputsAreValid, ValidityMessages(DialogSection,
     62                                                 const FieldValueMap&));
     63   MOCK_METHOD6(UserEditedOrActivatedInput, void(DialogSection,
     64                                                 ServerFieldType,
     65                                                 gfx::NativeView,
     66                                                 const gfx::Rect&,
     67                                                 const base::string16&,
     68                                                 bool was_edit));
     69   MOCK_METHOD1(HandleKeyPressEventInInput,
     70                bool(const content::NativeWebKeyboardEvent& event));
     71   MOCK_METHOD0(FocusMoved, void());
     72   MOCK_CONST_METHOD0(ShouldShowErrorBubble, bool());
     73   MOCK_METHOD0(ViewClosed, void());
     74   MOCK_METHOD0(CurrentNotifications,std::vector<DialogNotification>());
     75   MOCK_METHOD1(LinkClicked, void(const GURL&));
     76   MOCK_METHOD0(SignInLinkClicked, void());
     77   MOCK_METHOD2(NotificationCheckboxStateChanged,
     78                void(DialogNotification::Type, bool));
     79   MOCK_METHOD1(LegalDocumentLinkClicked, void(const gfx::Range&));
     80   MOCK_METHOD0(OverlayButtonPressed, void());
     81   MOCK_METHOD0(OnCancel, bool());
     82   MOCK_METHOD0(OnAccept, bool());
     83   MOCK_METHOD0(profile, Profile*());
     84   MOCK_METHOD0(GetWebContents, content::WebContents*());
     85 
     86   // Set which web contents initiated showing the dialog.
     87   void SetWebContents(content::WebContents* contents);
     88 
     89   // Set which profile to use for mock |profile()| calls.
     90   void SetProfile(Profile* profile);
     91 
     92  private:
     93   DetailInputs default_inputs_;
     94   DetailInputs cc_default_inputs_;  // Default inputs for SECTION_CC.
     95   std::vector<gfx::Range> range_;
     96 
     97   DISALLOW_COPY_AND_ASSIGN(MockAutofillDialogViewDelegate);
     98 };
     99 
    100 }  // namespace autofill
    101 
    102 #endif  // CHROME_BROWSER_UI_AUTOFILL_MOCK_AUTOFILL_DIALOG_VIEW_DELEGATE_H_
    103