Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: chrome/browser/ui/autofill/mock_autofill_dialog_controller.cc

Issue 21692002: Rename AutofillDialogController to AutofillDialogViewDelegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 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 #include "chrome/browser/ui/autofill/mock_autofill_dialog_controller.h"
6 #include "content/public/browser/native_web_keyboard_event.h" // For gmock.
7 #include "grit/generated_resources.h"
8 #include "ui/gfx/rect.h" // Only needed because gmock needs complete types.
9
10 namespace autofill {
11
12 MockAutofillDialogController::MockAutofillDialogController() {
13 using testing::DefaultValue;
14 using testing::_;
15 using testing::Return;
16 using testing::ReturnRef;
17
18 // N.B. Setting DefaultValue in the ctor and deleting it in the dtor will
19 // only work if this Mock is not used together with other mock code that
20 // sets different defaults. If tests utilizing the MockController start
21 // breaking because of this, use ON_CALL instead.
22 DefaultValue<const DetailInputs&>::Set(default_inputs_);
23 DefaultValue<string16>::Set(string16());
24 DefaultValue<ValidityData>::Set(ValidityData());
25 DefaultValue<DialogSignedInState>::Set(REQUIRES_RESPONSE);
26 DefaultValue<gfx::Image>::Set(gfx::Image());
27 DefaultValue<SuggestionState>::Set(SuggestionState(string16(),
28 gfx::Font::NORMAL,
29 gfx::Image(),
30 string16(),
31 gfx::Image()));
32
33 // SECTION_CC *must* have a CREDIT_CARD_VERIFICATION_CODE field.
34 const DetailInput kCreditCardInputs[] = {
35 { 2, CREDIT_CARD_VERIFICATION_CODE, IDS_AUTOFILL_DIALOG_PLACEHOLDER_CVC }
36 };
37 cc_default_inputs_.push_back(kCreditCardInputs[0]);
38 ON_CALL(*this, RequestedFieldsForSection(SECTION_CC))
39 .WillByDefault(ReturnRef(cc_default_inputs_));
40
41 ON_CALL(*this, GetDialogButtons())
42 .WillByDefault(Return(ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL));
43 ON_CALL(*this, LegalDocumentLinks()).WillByDefault(ReturnRef(range_));
44
45 // Activate all sections but CC_BILLING - default for the real
46 // controller implementation, too.
47 ON_CALL(*this, SectionIsActive(_)).WillByDefault(Return(true));
48 ON_CALL(*this, SectionIsActive(SECTION_CC_BILLING))
49 .WillByDefault(Return(false));
50 }
51
52 MockAutofillDialogController::~MockAutofillDialogController() {
53 using testing::DefaultValue;
54
55 DefaultValue<SuggestionState>::Clear();
56 DefaultValue<gfx::Image>::Clear();
57 DefaultValue<DialogSignedInState>::Clear();
58 DefaultValue<ValidityData>::Clear();
59 DefaultValue<string16>::Clear();
60 DefaultValue<const DetailInputs&>::Clear();
61 }
62
63 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698