| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/guid.h" | 5 #include "base/guid.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" | 9 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" |
| 10 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" | 10 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 class TestAutofillDialogController : public AutofillDialogControllerImpl { | 117 class TestAutofillDialogController : public AutofillDialogControllerImpl { |
| 118 public: | 118 public: |
| 119 TestAutofillDialogController( | 119 TestAutofillDialogController( |
| 120 content::WebContents* contents, | 120 content::WebContents* contents, |
| 121 const FormData& form_structure, | 121 const FormData& form_structure, |
| 122 const GURL& source_url, | 122 const GURL& source_url, |
| 123 const AutofillMetrics& metric_logger, | 123 const AutofillMetrics& metric_logger, |
| 124 const DialogType dialog_type, | 124 const DialogType dialog_type, |
| 125 const base::Callback<void(const FormStructure*)>& callback) | 125 const base::Callback<void(const FormStructure*, |
| 126 const std::string&)>& callback) |
| 126 : AutofillDialogControllerImpl(contents, | 127 : AutofillDialogControllerImpl(contents, |
| 127 form_structure, | 128 form_structure, |
| 128 source_url, | 129 source_url, |
| 129 metric_logger, | 130 metric_logger, |
| 130 dialog_type, | 131 dialog_type, |
| 131 callback), | 132 callback), |
| 132 ALLOW_THIS_IN_INITIALIZER_LIST(test_wallet_client_( | 133 ALLOW_THIS_IN_INITIALIZER_LIST(test_wallet_client_( |
| 133 Profile::FromBrowserContext(contents->GetBrowserContext())-> | 134 Profile::FromBrowserContext(contents->GetBrowserContext())-> |
| 134 GetRequestContext(), this)), | 135 GetRequestContext(), this)), |
| 135 is_paying_with_wallet_(false) {} | 136 is_paying_with_wallet_(false) {} |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 field.autocomplete_attribute = "cc-number"; | 197 field.autocomplete_attribute = "cc-number"; |
| 197 FormData form_data; | 198 FormData form_data; |
| 198 form_data.fields.push_back(field); | 199 form_data.fields.push_back(field); |
| 199 | 200 |
| 200 profile()->GetPrefs()->SetBoolean( | 201 profile()->GetPrefs()->SetBoolean( |
| 201 prefs::kAutofillDialogPayWithoutWallet, true); | 202 prefs::kAutofillDialogPayWithoutWallet, true); |
| 202 profile()->CreateRequestContext(); | 203 profile()->CreateRequestContext(); |
| 203 test_web_contents_.reset( | 204 test_web_contents_.reset( |
| 204 content::WebContentsTester::CreateTestWebContents(profile(), NULL)); | 205 content::WebContentsTester::CreateTestWebContents(profile(), NULL)); |
| 205 | 206 |
| 206 base::Callback<void(const FormStructure*)> callback; | 207 base::Callback<void(const FormStructure*, const std::string&)> callback; |
| 207 controller_ = new TestAutofillDialogController( | 208 controller_ = new TestAutofillDialogController( |
| 208 test_web_contents_.get(), | 209 test_web_contents_.get(), |
| 209 form_data, | 210 form_data, |
| 210 GURL(), | 211 GURL(), |
| 211 metric_logger_, | 212 metric_logger_, |
| 212 DIALOG_TYPE_REQUEST_AUTOCOMPLETE, | 213 DIALOG_TYPE_REQUEST_AUTOCOMPLETE, |
| 213 callback); | 214 callback); |
| 214 controller_->Show(); | 215 controller_->Show(); |
| 215 } | 216 } |
| 216 | 217 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 TEST_F(AutofillDialogControllerTest, Cancel) { | 386 TEST_F(AutofillDialogControllerTest, Cancel) { |
| 386 controller()->set_is_paying_with_wallet(true); | 387 controller()->set_is_paying_with_wallet(true); |
| 387 | 388 |
| 388 EXPECT_CALL(*controller()->GetView(), ModelChanged()).Times(1); | 389 EXPECT_CALL(*controller()->GetView(), ModelChanged()).Times(1); |
| 389 | 390 |
| 390 controller()->OnDidGetWalletItems(wallet::GetTestWalletItems()); | 391 controller()->OnDidGetWalletItems(wallet::GetTestWalletItems()); |
| 391 controller()->OnCancel(); | 392 controller()->OnCancel(); |
| 392 } | 393 } |
| 393 | 394 |
| 394 } // namespace autofill | 395 } // namespace autofill |
| OLD | NEW |