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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/memory/weak_ptr.h" | 6 #include "base/memory/weak_ptr.h" |
7 #include "base/prefs/testing_pref_service.h" | 7 #include "base/prefs/testing_pref_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" | 9 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" |
10 #include "chrome/browser/ui/autofill/autofill_popup_view.h" | 10 #include "chrome/browser/ui/autofill/autofill_popup_view.h" |
11 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 11 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
12 #include "chrome/test/base/testing_profile.h" | 12 #include "chrome/test/base/testing_profile.h" |
13 #include "components/autofill/browser/autofill_external_delegate.h" | 13 #include "components/autofill/browser/autofill_external_delegate.h" |
14 #include "components/autofill/browser/autofill_manager.h" | 14 #include "components/autofill/browser/autofill_manager.h" |
15 #include "components/autofill/browser/test_autofill_external_delegate.h" | 15 #include "components/autofill/browser/test_autofill_external_delegate.h" |
16 #include "components/autofill/browser/test_autofill_manager_delegate.h" | 16 #include "components/autofill/browser/test_autofill_manager_delegate.h" |
| 17 #include "components/autofill/content/browser/autofill_driver_impl.h" |
17 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" |
20 #include "ui/gfx/display.h" | 21 #include "ui/gfx/display.h" |
21 #include "ui/gfx/rect.h" | 22 #include "ui/gfx/rect.h" |
22 | 23 |
23 using ::testing::_; | 24 using ::testing::_; |
24 using ::testing::AtLeast; | 25 using ::testing::AtLeast; |
25 using ::testing::NiceMock; | 26 using ::testing::NiceMock; |
26 using base::WeakPtr; | 27 using base::WeakPtr; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 class AutofillPopupControllerUnitTest : public ChromeRenderViewHostTestHarness { | 148 class AutofillPopupControllerUnitTest : public ChromeRenderViewHostTestHarness { |
148 public: | 149 public: |
149 AutofillPopupControllerUnitTest() | 150 AutofillPopupControllerUnitTest() |
150 : manager_delegate_(new MockAutofillManagerDelegate()), | 151 : manager_delegate_(new MockAutofillManagerDelegate()), |
151 autofill_popup_controller_(NULL) {} | 152 autofill_popup_controller_(NULL) {} |
152 virtual ~AutofillPopupControllerUnitTest() {} | 153 virtual ~AutofillPopupControllerUnitTest() {} |
153 | 154 |
154 virtual void SetUp() OVERRIDE { | 155 virtual void SetUp() OVERRIDE { |
155 ChromeRenderViewHostTestHarness::SetUp(); | 156 ChromeRenderViewHostTestHarness::SetUp(); |
156 | 157 |
157 AutofillManager::CreateForWebContentsAndDelegate( | 158 AutofillDriverImpl::CreateForWebContentsAndDelegate( |
158 web_contents(), | 159 web_contents(), |
159 manager_delegate_.get(), | 160 manager_delegate_.get(), |
160 "en-US", | 161 "en-US", |
161 AutofillManager::ENABLE_AUTOFILL_DOWNLOAD_MANAGER); | 162 AutofillManager::ENABLE_AUTOFILL_DOWNLOAD_MANAGER, |
| 163 false); |
162 external_delegate_.reset( | 164 external_delegate_.reset( |
163 new NiceMock<MockAutofillExternalDelegate>( | 165 new NiceMock<MockAutofillExternalDelegate>( |
164 web_contents(), AutofillManager::FromWebContents(web_contents()))); | 166 web_contents(), AutofillManager::FromWebContents(web_contents()))); |
165 | 167 |
166 autofill_popup_controller_ = | 168 autofill_popup_controller_ = |
167 new testing::NiceMock<TestAutofillPopupController>( | 169 new testing::NiceMock<TestAutofillPopupController>( |
168 external_delegate_->GetWeakPtr(), gfx::Rect()); | 170 external_delegate_->GetWeakPtr(), gfx::Rect()); |
169 } | 171 } |
170 | 172 |
171 virtual void TearDown() OVERRIDE { | 173 virtual void TearDown() OVERRIDE { |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 EXPECT_EQ(expected_popup_bounds[i].ToString(), | 526 EXPECT_EQ(expected_popup_bounds[i].ToString(), |
525 autofill_popup_controller->popup_bounds().ToString()) << | 527 autofill_popup_controller->popup_bounds().ToString()) << |
526 "Popup bounds failed to match for test " << i; | 528 "Popup bounds failed to match for test " << i; |
527 | 529 |
528 // Hide the controller to delete it. | 530 // Hide the controller to delete it. |
529 autofill_popup_controller->DoHide(); | 531 autofill_popup_controller->DoHide(); |
530 } | 532 } |
531 } | 533 } |
532 | 534 |
533 } // namespace autofill | 535 } // namespace autofill |
OLD | NEW |