| 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" | |
| 11 #include "components/autofill/content/browser/autocheckout_manager.h" | 10 #include "components/autofill/content/browser/autocheckout_manager.h" |
| 12 #include "components/autofill/core/browser/autofill_common_test.h" | 11 #include "components/autofill/core/browser/autofill_common_test.h" |
| 13 #include "components/autofill/core/browser/autofill_manager.h" | 12 #include "components/autofill/core/browser/autofill_manager.h" |
| 14 #include "components/autofill/core/browser/autofill_metrics.h" | 13 #include "components/autofill/core/browser/autofill_metrics.h" |
| 15 #include "components/autofill/core/browser/form_structure.h" | 14 #include "components/autofill/core/browser/form_structure.h" |
| 16 #include "components/autofill/core/browser/test_autofill_driver.h" | 15 #include "components/autofill/core/browser/test_autofill_driver.h" |
| 17 #include "components/autofill/core/browser/test_autofill_manager_delegate.h" | 16 #include "components/autofill/core/browser/test_autofill_manager_delegate.h" |
| 18 #include "components/autofill/core/common/autofill_messages.h" | 17 #include "components/autofill/core/common/autofill_messages.h" |
| 19 #include "components/autofill/core/common/form_data.h" | 18 #include "components/autofill/core/common/form_data.h" |
| 20 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 using AutocheckoutManager::ReturnAutocheckoutData; | 400 using AutocheckoutManager::ReturnAutocheckoutData; |
| 402 }; | 401 }; |
| 403 | 402 |
| 404 } // namespace | 403 } // namespace |
| 405 | 404 |
| 406 class AutocheckoutManagerTest : public ChromeRenderViewHostTestHarness { | 405 class AutocheckoutManagerTest : public ChromeRenderViewHostTestHarness { |
| 407 protected: | 406 protected: |
| 408 virtual void SetUp() OVERRIDE { | 407 virtual void SetUp() OVERRIDE { |
| 409 SetThreadBundleOptions(content::TestBrowserThreadBundle::REAL_IO_THREAD); | 408 SetThreadBundleOptions(content::TestBrowserThreadBundle::REAL_IO_THREAD); |
| 410 ChromeRenderViewHostTestHarness::SetUp(); | 409 ChromeRenderViewHostTestHarness::SetUp(); |
| 411 profile()->CreateRequestContext(); | |
| 412 autofill_manager_delegate_.reset(new MockAutofillManagerDelegate()); | 410 autofill_manager_delegate_.reset(new MockAutofillManagerDelegate()); |
| 413 autofill_driver_.reset(new TestAutofillDriver(web_contents())); | 411 autofill_driver_.reset(new TestAutofillDriver(web_contents())); |
| 414 autofill_manager_.reset(new TestAutofillManager( | 412 autofill_manager_.reset(new TestAutofillManager( |
| 415 autofill_driver_.get(), | 413 autofill_driver_.get(), |
| 416 autofill_manager_delegate_.get())); | 414 autofill_manager_delegate_.get())); |
| 417 autocheckout_manager_.reset( | 415 autocheckout_manager_.reset( |
| 418 new TestAutocheckoutManager(autofill_manager_.get())); | 416 new TestAutocheckoutManager(autofill_manager_.get())); |
| 419 } | 417 } |
| 420 | 418 |
| 421 virtual void TearDown() OVERRIDE { | 419 virtual void TearDown() OVERRIDE { |
| 422 autocheckout_manager_.reset(); | 420 autocheckout_manager_.reset(); |
| 423 autofill_manager_delegate_.reset(); | 421 autofill_manager_delegate_.reset(); |
| 424 autofill_manager_.reset(); | 422 autofill_manager_.reset(); |
| 425 autofill_driver_.reset(); | 423 autofill_driver_.reset(); |
| 426 profile()->ResetRequestContext(); | |
| 427 ChromeRenderViewHostTestHarness::TearDown(); | 424 ChromeRenderViewHostTestHarness::TearDown(); |
| 428 } | 425 } |
| 429 | 426 |
| 430 std::vector<FormData> ReadFilledForms() { | 427 std::vector<FormData> ReadFilledForms() { |
| 431 uint32 kMsgID = AutofillMsg_FillFormsAndClick::ID; | 428 uint32 kMsgID = AutofillMsg_FillFormsAndClick::ID; |
| 432 const IPC::Message* message = | 429 const IPC::Message* message = |
| 433 process()->sink().GetFirstMessageMatching(kMsgID); | 430 process()->sink().GetFirstMessageMatching(kMsgID); |
| 434 AutofillParam autofill_param; | 431 AutofillParam autofill_param; |
| 435 AutofillMsg_FillFormsAndClick::Read(message, &autofill_param); | 432 AutofillMsg_FillFormsAndClick::Read(message, &autofill_param); |
| 436 return autofill_param.a; | 433 return autofill_param.a; |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 frame_url, | 856 frame_url, |
| 860 AUTOCHECKOUT_BUBBLE_CANCELED); | 857 AUTOCHECKOUT_BUBBLE_CANCELED); |
| 861 EXPECT_FALSE(autocheckout_manager_->is_autocheckout_bubble_showing()); | 858 EXPECT_FALSE(autocheckout_manager_->is_autocheckout_bubble_showing()); |
| 862 EXPECT_FALSE(autocheckout_manager_->should_show_bubble()); | 859 EXPECT_FALSE(autocheckout_manager_->should_show_bubble()); |
| 863 | 860 |
| 864 autocheckout_manager_->MaybeShowAutocheckoutBubble(frame_url, bounding_box); | 861 autocheckout_manager_->MaybeShowAutocheckoutBubble(frame_url, bounding_box); |
| 865 EXPECT_FALSE(autocheckout_manager_->is_autocheckout_bubble_showing()); | 862 EXPECT_FALSE(autocheckout_manager_->is_autocheckout_bubble_showing()); |
| 866 } | 863 } |
| 867 | 864 |
| 868 } // namespace autofill | 865 } // namespace autofill |
| OLD | NEW |