| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 119 // be destroyed at the destruction of the WebContents. | 119 // be destroyed at the destruction of the WebContents. |
| 120 autofill_manager_ = NULL; | 120 autofill_manager_ = NULL; |
| 121 external_delegate_.reset(); |
| 121 ChromeRenderViewHostTestHarness::TearDown(); | 122 ChromeRenderViewHostTestHarness::TearDown(); |
| 122 } | 123 } |
| 123 | 124 |
| 124 content::TestBrowserThread ui_thread_; | 125 content::TestBrowserThread ui_thread_; |
| 125 | 126 |
| 126 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegateUnitTest); | 127 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegateUnitTest); |
| 127 }; | 128 }; |
| 128 | 129 |
| 129 // Test that our external delegate called the virtual methods at the right time. | 130 // Test that our external delegate called the virtual methods at the right time. |
| 130 TEST_F(AutofillExternalDelegateUnitTest, TestExternalDelegateVirtualCalls) { | 131 TEST_F(AutofillExternalDelegateUnitTest, TestExternalDelegateVirtualCalls) { |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 EXPECT_CALL(*autofill_manager_, OnFillAutofillFormData(_, _, _, _)); | 285 EXPECT_CALL(*autofill_manager_, OnFillAutofillFormData(_, _, _, _)); |
| 285 | 286 |
| 286 EXPECT_CALL(*external_delegate_, HideAutofillPopup()); | 287 EXPECT_CALL(*external_delegate_, HideAutofillPopup()); |
| 287 | 288 |
| 288 // This should trigger a call to hide the popup since | 289 // This should trigger a call to hide the popup since |
| 289 // we've selected an option. | 290 // we've selected an option. |
| 290 external_delegate_->DidAcceptSuggestion( | 291 external_delegate_->DidAcceptSuggestion( |
| 291 suggestions[0], | 292 suggestions[0], |
| 292 WebAutofillClient::MenuItemIDPasswordEntry); | 293 WebAutofillClient::MenuItemIDPasswordEntry); |
| 293 } | 294 } |
| OLD | NEW |