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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "chrome/browser/autofill/autofill_manager.h" | 10 #include "chrome/browser/autofill/autofill_manager.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 external_delegate_->OnQuery(query_id, form, field, element_bounds, false); | 95 external_delegate_->OnQuery(query_id, form, field, element_bounds, false); |
96 } | 96 } |
97 | 97 |
98 scoped_refptr<MockAutofillManager> autofill_manager_; | 98 scoped_refptr<MockAutofillManager> autofill_manager_; |
99 scoped_ptr<testing::NiceMock<MockAutofillExternalDelegate> > | 99 scoped_ptr<testing::NiceMock<MockAutofillExternalDelegate> > |
100 external_delegate_; | 100 external_delegate_; |
101 | 101 |
102 private: | 102 private: |
103 virtual void SetUp() OVERRIDE { | 103 virtual void SetUp() OVERRIDE { |
104 ChromeRenderViewHostTestHarness::SetUp(); | 104 ChromeRenderViewHostTestHarness::SetUp(); |
105 TabAutofillManagerDelegate::CreateForWebContents(web_contents()); | 105 autofill::TabAutofillManagerDelegate::CreateForWebContents(web_contents()); |
106 autofill_manager_ = new MockAutofillManager( | 106 autofill_manager_ = new MockAutofillManager( |
107 web_contents(), | 107 web_contents(), |
108 TabAutofillManagerDelegate::FromWebContents(web_contents())); | 108 autofill::TabAutofillManagerDelegate::FromWebContents(web_contents())); |
109 external_delegate_.reset( | 109 external_delegate_.reset( |
110 new testing::NiceMock<MockAutofillExternalDelegate>( | 110 new testing::NiceMock<MockAutofillExternalDelegate>( |
111 web_contents(), | 111 web_contents(), |
112 autofill_manager_)); | 112 autofill_manager_)); |
113 } | 113 } |
114 | 114 |
115 virtual void TearDown() OVERRIDE { | 115 virtual void TearDown() OVERRIDE { |
116 // Order of destruction is important as AutofillManager relies on | 116 // Order of destruction is important as AutofillManager relies on |
117 // PersonalDataManager to be around when it gets destroyed. Also, a real | 117 // PersonalDataManager to be around when it gets destroyed. Also, a real |
118 // AutofillManager is tied to the lifetime of the WebContents, so it must | 118 // AutofillManager is tied to the lifetime of the WebContents, so it must |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 EXPECT_CALL(*autofill_manager_, OnFillAutofillFormData(_, _, _, _)); | 284 EXPECT_CALL(*autofill_manager_, OnFillAutofillFormData(_, _, _, _)); |
285 | 285 |
286 EXPECT_CALL(*external_delegate_, HideAutofillPopup()); | 286 EXPECT_CALL(*external_delegate_, HideAutofillPopup()); |
287 | 287 |
288 // This should trigger a call to hide the popup since | 288 // This should trigger a call to hide the popup since |
289 // we've selected an option. | 289 // we've selected an option. |
290 external_delegate_->DidAcceptSuggestion( | 290 external_delegate_->DidAcceptSuggestion( |
291 suggestions[0], | 291 suggestions[0], |
292 WebAutofillClient::MenuItemIDPasswordEntry); | 292 WebAutofillClient::MenuItemIDPasswordEntry); |
293 } | 293 } |
OLD | NEW |