| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "chrome/browser/ui/autofill/autofill_popup_view.h" | 7 #include "chrome/browser/ui/autofill/autofill_popup_view.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
| 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 11 #include "chrome/test/base/in_process_browser_test.h" | 11 #include "chrome/test/base/in_process_browser_test.h" |
| 12 #include "components/autofill/content/browser/content_autofill_driver.h" | 12 #include "components/autofill/content/browser/content_autofill_driver.h" |
| 13 #include "components/autofill/content/browser/content_autofill_driver_factory.h" |
| 13 #include "components/autofill/core/browser/autofill_manager.h" | 14 #include "components/autofill/core/browser/autofill_manager.h" |
| 14 #include "components/autofill/core/browser/test_autofill_external_delegate.h" | 15 #include "components/autofill/core/browser/test_autofill_external_delegate.h" |
| 15 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 16 #include "content/public/browser/web_contents_observer.h" | 17 #include "content/public/browser/web_contents_observer.h" |
| 17 #include "content/public/test/test_utils.h" | 18 #include "content/public/test/test_utils.h" |
| 18 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
| 19 #include "ui/gfx/vector2d.h" | 20 #include "ui/gfx/vector2d.h" |
| 20 | 21 |
| 21 namespace autofill { | 22 namespace autofill { |
| 22 namespace { | 23 namespace { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 AutofillPopupControllerBrowserTest() {} | 72 AutofillPopupControllerBrowserTest() {} |
| 72 ~AutofillPopupControllerBrowserTest() override {} | 73 ~AutofillPopupControllerBrowserTest() override {} |
| 73 | 74 |
| 74 void SetUpOnMainThread() override { | 75 void SetUpOnMainThread() override { |
| 75 content::WebContents* web_contents = | 76 content::WebContents* web_contents = |
| 76 browser()->tab_strip_model()->GetActiveWebContents(); | 77 browser()->tab_strip_model()->GetActiveWebContents(); |
| 77 ASSERT_TRUE(web_contents != NULL); | 78 ASSERT_TRUE(web_contents != NULL); |
| 78 Observe(web_contents); | 79 Observe(web_contents); |
| 79 | 80 |
| 80 ContentAutofillDriver* driver = | 81 ContentAutofillDriver* driver = |
| 81 ContentAutofillDriver::FromWebContents(web_contents); | 82 ContentAutofillDriverFactory::FromWebContents(web_contents) |
| 83 ->DriverForFrame(web_contents->GetMainFrame()); |
| 82 autofill_external_delegate_.reset( | 84 autofill_external_delegate_.reset( |
| 83 new TestAutofillExternalDelegate( | 85 new TestAutofillExternalDelegate( |
| 84 web_contents, | 86 web_contents, |
| 85 driver->autofill_manager(), | 87 driver->autofill_manager(), |
| 86 driver)); | 88 driver)); |
| 87 } | 89 } |
| 88 | 90 |
| 89 // Normally the WebContents will automatically delete the delegate, but here | 91 // Normally the WebContents will automatically delete the delegate, but here |
| 90 // the delegate is owned by this test, so we have to manually destroy. | 92 // the delegate is owned by this test, so we have to manually destroy. |
| 91 void WebContentsDestroyed() override { autofill_external_delegate_.reset(); } | 93 void WebContentsDestroyed() override { autofill_external_delegate_.reset(); } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 MAYBE_DeleteDelegateBeforePopupHidden){ | 128 MAYBE_DeleteDelegateBeforePopupHidden){ |
| 127 GenerateTestAutofillPopup(autofill_external_delegate_.get()); | 129 GenerateTestAutofillPopup(autofill_external_delegate_.get()); |
| 128 | 130 |
| 129 // Delete the external delegate here so that is gets deleted before popup is | 131 // Delete the external delegate here so that is gets deleted before popup is |
| 130 // hidden. This can happen if the web_contents are destroyed before the popup | 132 // hidden. This can happen if the web_contents are destroyed before the popup |
| 131 // is hidden. See http://crbug.com/232475 | 133 // is hidden. See http://crbug.com/232475 |
| 132 autofill_external_delegate_.reset(); | 134 autofill_external_delegate_.reset(); |
| 133 } | 135 } |
| 134 | 136 |
| 135 } // namespace autofill | 137 } // namespace autofill |
| OLD | NEW |