| 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 <map> | 5 #include <map> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/guid.h" | 9 #include "base/guid.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 virtual DialogType GetDialogType() const OVERRIDE { | 274 virtual DialogType GetDialogType() const OVERRIDE { |
| 275 return dialog_type_; | 275 return dialog_type_; |
| 276 } | 276 } |
| 277 | 277 |
| 278 void set_dialog_type(DialogType dialog_type) { dialog_type_ = dialog_type; } | 278 void set_dialog_type(DialogType dialog_type) { dialog_type_ = dialog_type; } |
| 279 | 279 |
| 280 void SimulateSigninError() { | 280 void SimulateSigninError() { |
| 281 OnWalletSigninError(); | 281 OnWalletSigninError(); |
| 282 } | 282 } |
| 283 | 283 |
| 284 void SimulateSubmitButtonDelayBegin() { |
| 285 AutofillDialogControllerImpl::SubmitButtonDelayBegin(); |
| 286 } |
| 287 |
| 288 void SimulateSubmitButtonDelayEnd() { |
| 289 AutofillDialogControllerImpl::OnSubmitButtonDelayEnd(); |
| 290 } |
| 291 |
| 284 MOCK_METHOD0(LoadRiskFingerprintData, void()); | 292 MOCK_METHOD0(LoadRiskFingerprintData, void()); |
| 285 using AutofillDialogControllerImpl::OnDidLoadRiskFingerprintData; | 293 using AutofillDialogControllerImpl::OnDidLoadRiskFingerprintData; |
| 286 using AutofillDialogControllerImpl::IsEditingExistingData; | 294 using AutofillDialogControllerImpl::IsEditingExistingData; |
| 287 | 295 |
| 288 protected: | 296 protected: |
| 289 virtual PersonalDataManager* GetManager() OVERRIDE { | 297 virtual PersonalDataManager* GetManager() OVERRIDE { |
| 290 return &test_manager_; | 298 return &test_manager_; |
| 291 } | 299 } |
| 292 | 300 |
| 293 virtual wallet::WalletClient* GetWalletClient() OVERRIDE { | 301 virtual wallet::WalletClient* GetWalletClient() OVERRIDE { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 304 return true; | 312 return true; |
| 305 } | 313 } |
| 306 | 314 |
| 307 virtual void ShowNewCreditCardBubble( | 315 virtual void ShowNewCreditCardBubble( |
| 308 scoped_ptr<CreditCard> new_card, | 316 scoped_ptr<CreditCard> new_card, |
| 309 scoped_ptr<AutofillProfile> billing_profile) OVERRIDE { | 317 scoped_ptr<AutofillProfile> billing_profile) OVERRIDE { |
| 310 mock_new_card_bubble_controller_->Show(new_card.Pass(), | 318 mock_new_card_bubble_controller_->Show(new_card.Pass(), |
| 311 billing_profile.Pass()); | 319 billing_profile.Pass()); |
| 312 } | 320 } |
| 313 | 321 |
| 322 virtual void SubmitButtonDelayBegin() OVERRIDE { |
| 323 // Ignore in testing. |
| 324 } |
| 325 |
| 326 virtual void OnSubmitButtonDelayEnd() OVERRIDE { |
| 327 // Ignore in testing. |
| 328 } |
| 329 |
| 314 private: | 330 private: |
| 315 // To specify our own metric logger. | 331 // To specify our own metric logger. |
| 316 virtual const AutofillMetrics& GetMetricLogger() const OVERRIDE { | 332 virtual const AutofillMetrics& GetMetricLogger() const OVERRIDE { |
| 317 return metric_logger_; | 333 return metric_logger_; |
| 318 } | 334 } |
| 319 | 335 |
| 320 const AutofillMetrics& metric_logger_; | 336 const AutofillMetrics& metric_logger_; |
| 321 TestPersonalDataManager test_manager_; | 337 TestPersonalDataManager test_manager_; |
| 322 testing::NiceMock<wallet::MockWalletClient> mock_wallet_client_; | 338 testing::NiceMock<wallet::MockWalletClient> mock_wallet_client_; |
| 323 GURL open_tab_url_; | 339 GURL open_tab_url_; |
| (...skipping 2064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2388 TEST_F(AutofillDialogControllerTest, | 2404 TEST_F(AutofillDialogControllerTest, |
| 2389 SaveInChromePreferenceRememberedOnSuccess) { | 2405 SaveInChromePreferenceRememberedOnSuccess) { |
| 2390 EXPECT_TRUE(controller()->ShouldSaveInChrome()); | 2406 EXPECT_TRUE(controller()->ShouldSaveInChrome()); |
| 2391 SwitchToAutofill(); | 2407 SwitchToAutofill(); |
| 2392 FillCreditCardInputs(); | 2408 FillCreditCardInputs(); |
| 2393 controller()->GetView()->CheckSaveDetailsLocallyCheckbox(false); | 2409 controller()->GetView()->CheckSaveDetailsLocallyCheckbox(false); |
| 2394 controller()->OnAccept(); | 2410 controller()->OnAccept(); |
| 2395 EXPECT_FALSE(controller()->ShouldSaveInChrome()); | 2411 EXPECT_FALSE(controller()->ShouldSaveInChrome()); |
| 2396 } | 2412 } |
| 2397 | 2413 |
| 2414 TEST_F(AutofillDialogControllerTest, SubmitButtonDelayedOnStart) { |
| 2415 controller()->SimulateSubmitButtonDelayBegin(); |
| 2416 SwitchToAutofill(); |
| 2417 EXPECT_FALSE(controller()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); |
| 2418 controller()->SimulateSubmitButtonDelayEnd(); |
| 2419 EXPECT_TRUE(controller()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); |
| 2420 } |
| 2421 |
| 2398 } // namespace autofill | 2422 } // namespace autofill |
| OLD | NEW |