Index: chrome/browser/ui/autofill/autofill_popup_controller_interactive_uitest.cc |
diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_interactive_uitest.cc b/chrome/browser/ui/autofill/autofill_popup_controller_interactive_uitest.cc |
index 75cdeb1000055be159186f85bdfbf3976e94a110..04088c2be4eadd75c1f3cbcccee7f73265143588 100644 |
--- a/chrome/browser/ui/autofill/autofill_popup_controller_interactive_uitest.cc |
+++ b/chrome/browser/ui/autofill/autofill_popup_controller_interactive_uitest.cc |
@@ -13,6 +13,7 @@ |
#include "components/autofill/content/browser/content_autofill_driver_factory.h" |
#include "components/autofill/core/browser/autofill_manager.h" |
#include "components/autofill/core/browser/test_autofill_external_delegate.h" |
+#include "content/public/browser/render_frame_host.h" |
#include "content/public/browser/web_contents.h" |
#include "content/public/browser/web_contents_observer.h" |
#include "content/public/test/test_utils.h" |
@@ -88,9 +89,12 @@ class AutofillPopupControllerBrowserTest |
driver)); |
} |
- // Normally the WebContents will automatically delete the delegate, but here |
- // the delegate is owned by this test, so we have to manually destroy. |
- void WebContentsDestroyed() override { autofill_external_delegate_.reset(); } |
+ // The delegate lifetime is tied to the lifetime of the main frame, so |
+ // destroy it when the frame is deleted. |
Evan Stade
2015/02/13 22:09:20
nit: I sorta liked the old comment better
nasko
2015/02/13 22:11:49
Reverted.
|
+ void RenderFrameDeleted(content::RenderFrameHost* rfh) override { |
+ if (!rfh->GetParent()) |
+ autofill_external_delegate_.reset(); |
+ } |
protected: |
scoped_ptr<TestAutofillExternalDelegate> autofill_external_delegate_; |