OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/autofill/mock_autofill_dialog_view_delegate.h" | 5 #include "chrome/browser/ui/autofill/mock_autofill_dialog_view_delegate.h" |
6 #include "content/public/browser/native_web_keyboard_event.h" // For gmock. | 6 #include "content/public/browser/native_web_keyboard_event.h" // For gmock. |
7 #include "grit/generated_resources.h" | 7 #include "grit/generated_resources.h" |
8 #include "ui/gfx/rect.h" // Only needed because gmock needs complete types. | 8 #include "ui/gfx/rect.h" // Only needed because gmock needs complete types. |
9 | 9 |
10 namespace autofill { | 10 namespace autofill { |
11 | 11 |
12 MockAutofillDialogViewDelegate::MockAutofillDialogViewDelegate() { | 12 MockAutofillDialogViewDelegate::MockAutofillDialogViewDelegate() { |
13 using testing::DefaultValue; | 13 using testing::DefaultValue; |
14 using testing::_; | 14 using testing::_; |
15 using testing::Return; | 15 using testing::Return; |
16 using testing::ReturnRef; | 16 using testing::ReturnRef; |
17 | 17 |
18 // N.B. Setting DefaultValue in the ctor and deleting it in the dtor will | 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 | 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 | 20 // sets different defaults. If tests utilizing the MockController start |
21 // breaking because of this, use ON_CALL instead. | 21 // breaking because of this, use ON_CALL instead. |
22 DefaultValue<const DetailInputs&>::Set(default_inputs_); | 22 DefaultValue<const DetailInputs&>::Set(default_inputs_); |
23 DefaultValue<string16>::Set(string16()); | 23 DefaultValue<string16>::Set(string16()); |
24 DefaultValue<ValidityData>::Set(ValidityData()); | 24 DefaultValue<ValidityData>::Set(ValidityData()); |
25 DefaultValue<DialogSignedInState>::Set(REQUIRES_RESPONSE); | |
26 DefaultValue<gfx::Image>::Set(gfx::Image()); | 25 DefaultValue<gfx::Image>::Set(gfx::Image()); |
27 DefaultValue<SuggestionState>::Set(SuggestionState(false, | 26 DefaultValue<SuggestionState>::Set(SuggestionState(false, |
28 string16(), | 27 string16(), |
29 string16(), | 28 string16(), |
30 gfx::Image(), | 29 gfx::Image(), |
31 string16(), | 30 string16(), |
32 gfx::Image())); | 31 gfx::Image())); |
33 | 32 |
34 // SECTION_CC *must* have a CREDIT_CARD_VERIFICATION_CODE field. | 33 // SECTION_CC *must* have a CREDIT_CARD_VERIFICATION_CODE field. |
35 const DetailInput kCreditCardInputs[] = { | 34 const DetailInput kCreditCardInputs[] = { |
(...skipping 12 matching lines...) Expand all Loading... |
48 ON_CALL(*this, SectionIsActive(_)).WillByDefault(Return(true)); | 47 ON_CALL(*this, SectionIsActive(_)).WillByDefault(Return(true)); |
49 ON_CALL(*this, SectionIsActive(SECTION_CC_BILLING)) | 48 ON_CALL(*this, SectionIsActive(SECTION_CC_BILLING)) |
50 .WillByDefault(Return(false)); | 49 .WillByDefault(Return(false)); |
51 } | 50 } |
52 | 51 |
53 MockAutofillDialogViewDelegate::~MockAutofillDialogViewDelegate() { | 52 MockAutofillDialogViewDelegate::~MockAutofillDialogViewDelegate() { |
54 using testing::DefaultValue; | 53 using testing::DefaultValue; |
55 | 54 |
56 DefaultValue<SuggestionState>::Clear(); | 55 DefaultValue<SuggestionState>::Clear(); |
57 DefaultValue<gfx::Image>::Clear(); | 56 DefaultValue<gfx::Image>::Clear(); |
58 DefaultValue<DialogSignedInState>::Clear(); | |
59 DefaultValue<ValidityData>::Clear(); | 57 DefaultValue<ValidityData>::Clear(); |
60 DefaultValue<string16>::Clear(); | 58 DefaultValue<string16>::Clear(); |
61 DefaultValue<const DetailInputs&>::Clear(); | 59 DefaultValue<const DetailInputs&>::Clear(); |
62 } | 60 } |
63 | 61 |
64 } // namespace autofill | 62 } // namespace autofill |
OLD | NEW |