Chromium Code Reviews| 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 <map> | 5 #include <map> |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "base/tuple.h" | 8 #include "base/tuple.h" |
| 9 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 9 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
|
tfarina
2013/07/11 01:35:45
can you remove this now?
awong
2013/07/11 21:04:15
Done.
| |
| 11 #include "components/autofill/content/browser/autocheckout_manager.h" | 11 #include "components/autofill/content/browser/autocheckout_manager.h" |
| 12 #include "components/autofill/core/browser/autofill_common_test.h" | 12 #include "components/autofill/core/browser/autofill_common_test.h" |
| 13 #include "components/autofill/core/browser/autofill_manager.h" | 13 #include "components/autofill/core/browser/autofill_manager.h" |
| 14 #include "components/autofill/core/browser/autofill_metrics.h" | 14 #include "components/autofill/core/browser/autofill_metrics.h" |
| 15 #include "components/autofill/core/browser/form_structure.h" | 15 #include "components/autofill/core/browser/form_structure.h" |
| 16 #include "components/autofill/core/browser/test_autofill_driver.h" | 16 #include "components/autofill/core/browser/test_autofill_driver.h" |
| 17 #include "components/autofill/core/browser/test_autofill_manager_delegate.h" | 17 #include "components/autofill/core/browser/test_autofill_manager_delegate.h" |
| 18 #include "components/autofill/core/common/autofill_messages.h" | 18 #include "components/autofill/core/common/autofill_messages.h" |
| 19 #include "components/autofill/core/common/form_data.h" | 19 #include "components/autofill/core/common/form_data.h" |
| 20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 375 using AutocheckoutManager::ReturnAutocheckoutData; | 375 using AutocheckoutManager::ReturnAutocheckoutData; |
| 376 }; | 376 }; |
| 377 | 377 |
| 378 } // namespace | 378 } // namespace |
| 379 | 379 |
| 380 class AutocheckoutManagerTest : public ChromeRenderViewHostTestHarness { | 380 class AutocheckoutManagerTest : public ChromeRenderViewHostTestHarness { |
| 381 protected: | 381 protected: |
| 382 virtual void SetUp() OVERRIDE { | 382 virtual void SetUp() OVERRIDE { |
| 383 SetThreadBundleOptions(content::TestBrowserThreadBundle::REAL_IO_THREAD); | 383 SetThreadBundleOptions(content::TestBrowserThreadBundle::REAL_IO_THREAD); |
| 384 ChromeRenderViewHostTestHarness::SetUp(); | 384 ChromeRenderViewHostTestHarness::SetUp(); |
| 385 profile()->CreateRequestContext(); | |
| 386 autofill_manager_delegate_.reset(new MockAutofillManagerDelegate()); | 385 autofill_manager_delegate_.reset(new MockAutofillManagerDelegate()); |
| 387 autofill_driver_.reset(new TestAutofillDriver(web_contents())); | 386 autofill_driver_.reset(new TestAutofillDriver(web_contents())); |
| 388 autofill_manager_.reset(new TestAutofillManager( | 387 autofill_manager_.reset(new TestAutofillManager( |
| 389 autofill_driver_.get(), | 388 autofill_driver_.get(), |
| 390 autofill_manager_delegate_.get())); | 389 autofill_manager_delegate_.get())); |
| 391 autocheckout_manager_.reset( | 390 autocheckout_manager_.reset( |
| 392 new TestAutocheckoutManager(autofill_manager_.get())); | 391 new TestAutocheckoutManager(autofill_manager_.get())); |
| 393 } | 392 } |
| 394 | 393 |
| 395 virtual void TearDown() OVERRIDE { | 394 virtual void TearDown() OVERRIDE { |
| 396 autocheckout_manager_.reset(); | 395 autocheckout_manager_.reset(); |
| 397 autofill_manager_delegate_.reset(); | 396 autofill_manager_delegate_.reset(); |
| 398 autofill_manager_.reset(); | 397 autofill_manager_.reset(); |
| 399 autofill_driver_.reset(); | 398 autofill_driver_.reset(); |
| 400 profile()->ResetRequestContext(); | |
| 401 ChromeRenderViewHostTestHarness::TearDown(); | 399 ChromeRenderViewHostTestHarness::TearDown(); |
| 402 } | 400 } |
| 403 | 401 |
| 404 std::vector<FormData> ReadFilledForms() { | 402 std::vector<FormData> ReadFilledForms() { |
| 405 uint32 kMsgID = AutofillMsg_FillFormsAndClick::ID; | 403 uint32 kMsgID = AutofillMsg_FillFormsAndClick::ID; |
| 406 const IPC::Message* message = | 404 const IPC::Message* message = |
| 407 process()->sink().GetFirstMessageMatching(kMsgID); | 405 process()->sink().GetFirstMessageMatching(kMsgID); |
| 408 AutofillParam autofill_param; | 406 AutofillParam autofill_param; |
| 409 AutofillMsg_FillFormsAndClick::Read(message, &autofill_param); | 407 AutofillMsg_FillFormsAndClick::Read(message, &autofill_param); |
| 410 return autofill_param.a; | 408 return autofill_param.a; |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 800 AUTOCHECKOUT_STEP_COMPLETED)); | 798 AUTOCHECKOUT_STEP_COMPLETED)); |
| 801 EXPECT_TRUE(autofill_manager_delegate_ | 799 EXPECT_TRUE(autofill_manager_delegate_ |
| 802 ->AutocheckoutStepExistsWithStatus(AUTOCHECKOUT_STEP_DELIVERY, | 800 ->AutocheckoutStepExistsWithStatus(AUTOCHECKOUT_STEP_DELIVERY, |
| 803 AUTOCHECKOUT_STEP_COMPLETED)); | 801 AUTOCHECKOUT_STEP_COMPLETED)); |
| 804 EXPECT_TRUE(autofill_manager_delegate_ | 802 EXPECT_TRUE(autofill_manager_delegate_ |
| 805 ->AutocheckoutStepExistsWithStatus(AUTOCHECKOUT_STEP_BILLING, | 803 ->AutocheckoutStepExistsWithStatus(AUTOCHECKOUT_STEP_BILLING, |
| 806 AUTOCHECKOUT_STEP_COMPLETED)); | 804 AUTOCHECKOUT_STEP_COMPLETED)); |
| 807 } | 805 } |
| 808 | 806 |
| 809 } // namespace autofill | 807 } // namespace autofill |
| OLD | NEW |