1f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// found in the LICENSE file.
42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
5f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_
6f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)#define COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_
72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/compiler_specific.h"
97d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#include "base/i18n/rtl.h"
10a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "base/memory/scoped_ptr.h"
11a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "base/prefs/pref_service.h"
12f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)#include "components/autofill/core/browser/autofill_client.h"
132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace autofill {
152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
16a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// This class is for easier writing of tests.
17f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)class TestAutofillClient : public AutofillClient {
182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public:
19f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  TestAutofillClient();
20f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  virtual ~TestAutofillClient();
212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
22f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  // AutofillClient implementation.
232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual PersonalDataManager* GetPersonalDataManager() OVERRIDE;
24f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  virtual scoped_refptr<AutofillWebDataService> GetDatabase() OVERRIDE;
252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual PrefService* GetPrefs() OVERRIDE;
262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void HideRequestAutocompleteDialog() OVERRIDE;
272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void ShowAutofillSettings() OVERRIDE;
282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void ConfirmSaveCreditCard(
292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      const AutofillMetrics& metric_logger,
302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      const base::Closure& save_card_callback) OVERRIDE;
312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void ShowRequestAutocompleteDialog(
322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      const FormData& form,
332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      const GURL& source_url,
34a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      const ResultCallback& callback) OVERRIDE;
35c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  virtual void ShowAutofillPopup(
36c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)      const gfx::RectF& element_bounds,
377d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)      base::i18n::TextDirection text_direction,
38c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)      const std::vector<base::string16>& values,
39c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)      const std::vector<base::string16>& labels,
40c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)      const std::vector<base::string16>& icons,
41c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)      const std::vector<int>& identifiers,
42c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)      base::WeakPtr<AutofillPopupDelegate> delegate) OVERRIDE;
43ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  virtual void UpdateAutofillPopupDataListValues(
44ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch      const std::vector<base::string16>& values,
45ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch      const std::vector<base::string16>& labels) OVERRIDE;
462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void HideAutofillPopup() OVERRIDE;
47eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual bool IsAutocompleteEnabled() OVERRIDE;
48eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
4958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  virtual void DetectAccountCreationForms(
5058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)      const std::vector<autofill::FormStructure*>& forms) OVERRIDE;
512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
52a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual void DidFillOrPreviewField(
53a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      const base::string16& autofilled_value,
54a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      const base::string16& profile_full_name) OVERRIDE;
55a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
56a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  void SetPrefs(scoped_ptr<PrefService> prefs) { prefs_ = prefs.Pass(); }
57a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) private:
59a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // NULL by default.
60a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  scoped_ptr<PrefService> prefs_;
61a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
62f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(TestAutofillClient);
632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)};
642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}  // namespace autofill
662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
67f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)#endif  // COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_
68