autofill_dialog_view_tester.h revision 5d1f7b1de12d16ceb2c938c56701a3e8bfa558f7
1// Copyright 2014 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_AUTOFILL_DIALOG_VIEW_TESTER_H_ 6#define CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_TESTER_H_ 7 8#include "base/memory/scoped_ptr.h" 9#include "base/strings/string16.h" 10#include "chrome/browser/ui/autofill/autofill_dialog_types.h" 11#include "components/autofill/core/browser/field_types.h" 12#include "ui/gfx/size.h" 13 14namespace content { 15class WebContents; 16} 17 18namespace autofill { 19 20class AutofillDialogView; 21 22// Functionality that helps to test an AutofillDialogView. 23class AutofillDialogViewTester { 24 public: 25 // Gets a AutofillDialogViewTester for |view|. 26 static scoped_ptr<AutofillDialogViewTester> For(AutofillDialogView* view); 27 28 virtual ~AutofillDialogViewTester() {} 29 30 // Simulates the user pressing 'Submit' to accept the dialog. 31 virtual void SubmitForTesting() = 0; 32 33 // Simulates the user pressing 'Cancel' to abort the dialog. 34 virtual void CancelForTesting() = 0; 35 36 // Returns the actual contents of the input of |type|. 37 virtual base::string16 GetTextContentsOfInput(ServerFieldType type) = 0; 38 39 // Sets the actual contents of the input of |type|. 40 virtual void SetTextContentsOfInput(ServerFieldType type, 41 const base::string16& contents) = 0; 42 43 // Sets the content of the extra field for a section. 44 virtual void SetTextContentsOfSuggestionInput(DialogSection section, 45 const base::string16& text) = 0; 46 47 // Simulates a user activation of the input of |type|. 48 virtual void ActivateInput(ServerFieldType type) = 0; 49 50 // Get the size of the entire view. 51 virtual gfx::Size GetSize() const = 0; 52 53 // Get the web contents used to sign in to Google. 54 virtual content::WebContents* GetSignInWebContents() = 0; 55 56 // Whether the overlay is visible. 57 virtual bool IsShowingOverlay() const = 0; 58}; 59 60} // namespace autofill 61 62#endif // CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_DIALOG_VIEW_TESTER_H_ 63