Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(940)

Unified Diff: chrome/browser/ui/autofill/autofill_popup_controller_interactive_uitest.cc

Issue 921443003: Fix RenderFrameCreated and RenderFrameDeleted WebContentsObserver methods (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for autofill test. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_;

Powered by Google App Engine
This is Rietveld 408576698