| 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 DISALLOW_COPY_AND_ASSIGN(TestAutofillCreditCardBubbleController); | 313 DISALLOW_COPY_AND_ASSIGN(TestAutofillCreditCardBubbleController); |
| 314 }; | 314 }; |
| 315 | 315 |
| 316 class AutofillDialogControllerTest : public ChromeRenderViewHostTestHarness { | 316 class AutofillDialogControllerTest : public ChromeRenderViewHostTestHarness { |
| 317 protected: | 317 protected: |
| 318 AutofillDialogControllerTest(): form_structure_(NULL) {} | 318 AutofillDialogControllerTest(): form_structure_(NULL) {} |
| 319 | 319 |
| 320 // testing::Test implementation: | 320 // testing::Test implementation: |
| 321 virtual void SetUp() OVERRIDE { | 321 virtual void SetUp() OVERRIDE { |
| 322 ChromeRenderViewHostTestHarness::SetUp(); | 322 ChromeRenderViewHostTestHarness::SetUp(); |
| 323 profile()->CreateRequestContext(); | |
| 324 | 323 |
| 325 test_bubble_controller_ = | 324 test_bubble_controller_ = |
| 326 new testing::NiceMock<TestAutofillCreditCardBubbleController>( | 325 new testing::NiceMock<TestAutofillCreditCardBubbleController>( |
| 327 web_contents()); | 326 web_contents()); |
| 328 | 327 |
| 329 // Don't get stuck on the first run wallet interstitial. | 328 // Don't get stuck on the first run wallet interstitial. |
| 330 profile()->GetPrefs()->SetBoolean(::prefs::kAutofillDialogHasPaidWithWallet, | 329 profile()->GetPrefs()->SetBoolean(::prefs::kAutofillDialogHasPaidWithWallet, |
| 331 true); | 330 true); |
| 332 | 331 |
| 333 SetUpControllerWithFormData(DefaultFormData()); | 332 SetUpControllerWithFormData(DefaultFormData()); |
| 334 } | 333 } |
| 335 | 334 |
| 336 virtual void TearDown() OVERRIDE { | 335 virtual void TearDown() OVERRIDE { |
| 337 if (controller_) | 336 if (controller_) |
| 338 controller_->ViewClosed(); | 337 controller_->ViewClosed(); |
| 339 ChromeRenderViewHostTestHarness::TearDown(); | 338 ChromeRenderViewHostTestHarness::TearDown(); |
| 340 } | 339 } |
| 341 | 340 |
| 342 void Reset() { | 341 void Reset() { |
| 343 if (controller_) | 342 if (controller_) |
| 344 controller_->ViewClosed(); | 343 controller_->ViewClosed(); |
| 345 profile()->CreateRequestContext(); | |
| 346 | 344 |
| 347 test_bubble_controller_ = | 345 test_bubble_controller_ = |
| 348 new testing::NiceMock<TestAutofillCreditCardBubbleController>( | 346 new testing::NiceMock<TestAutofillCreditCardBubbleController>( |
| 349 web_contents()); | 347 web_contents()); |
| 350 | 348 |
| 351 // Don't get stuck on the first run wallet interstitial. | 349 // Don't get stuck on the first run wallet interstitial. |
| 352 profile()->GetPrefs()->SetBoolean(::prefs::kAutofillDialogHasPaidWithWallet, | 350 profile()->GetPrefs()->SetBoolean(::prefs::kAutofillDialogHasPaidWithWallet, |
| 353 true); | 351 true); |
| 354 | 352 |
| 355 SetUpControllerWithFormData(DefaultFormData()); | 353 SetUpControllerWithFormData(DefaultFormData()); |
| (...skipping 1924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2280 EXPECT_CALL(*test_bubble_controller(), | 2278 EXPECT_CALL(*test_bubble_controller(), |
| 2281 ShowAsGeneratedCardBubble(_, _)).Times(1); | 2279 ShowAsGeneratedCardBubble(_, _)).Times(1); |
| 2282 EXPECT_CALL(*test_bubble_controller(), ShowAsNewCardSavedBubble(_)).Times(0); | 2280 EXPECT_CALL(*test_bubble_controller(), ShowAsNewCardSavedBubble(_)).Times(0); |
| 2283 | 2281 |
| 2284 SubmitWithWalletItems(CompleteAndValidWalletItems()); | 2282 SubmitWithWalletItems(CompleteAndValidWalletItems()); |
| 2285 controller()->OnDidGetFullWallet(wallet::GetTestFullWallet()); | 2283 controller()->OnDidGetFullWallet(wallet::GetTestFullWallet()); |
| 2286 controller()->ViewClosed(); | 2284 controller()->ViewClosed(); |
| 2287 } | 2285 } |
| 2288 | 2286 |
| 2289 } // namespace autofill | 2287 } // namespace autofill |
| OLD | NEW |