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

Side by Side Diff: chrome/browser/ui/autofill/autofill_popup_controller_interactive_uitest.cc

Issue 257153003: We have a problem in the process on destroying WebContentsImpl because (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Rebased onto origin/master again, resolved conflicts Created 6 years, 7 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 unified diff | Download patch
OLDNEW
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"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } // namespace 65 } // namespace
66 66
67 class AutofillPopupControllerBrowserTest 67 class AutofillPopupControllerBrowserTest
68 : public InProcessBrowserTest, 68 : public InProcessBrowserTest,
69 public content::WebContentsObserver { 69 public content::WebContentsObserver {
70 public: 70 public:
71 AutofillPopupControllerBrowserTest() {} 71 AutofillPopupControllerBrowserTest() {}
72 virtual ~AutofillPopupControllerBrowserTest() {} 72 virtual ~AutofillPopupControllerBrowserTest() {}
73 73
74 virtual void SetUpOnMainThread() OVERRIDE { 74 virtual void SetUpOnMainThread() OVERRIDE {
75 web_contents_ = browser()->tab_strip_model()->GetActiveWebContents(); 75 content::WebContents* web_contents =
76 ASSERT_TRUE(web_contents_ != NULL); 76 browser()->tab_strip_model()->GetActiveWebContents();
77 Observe(web_contents_); 77 ASSERT_TRUE(web_contents != NULL);
78 Observe(web_contents);
78 79
79 ContentAutofillDriver* driver = 80 ContentAutofillDriver* driver =
80 ContentAutofillDriver::FromWebContents(web_contents_); 81 ContentAutofillDriver::FromWebContents(web_contents);
81 autofill_external_delegate_.reset( 82 autofill_external_delegate_.reset(
82 new TestAutofillExternalDelegate( 83 new TestAutofillExternalDelegate(
83 web_contents_, 84 web_contents,
84 driver->autofill_manager(), 85 driver->autofill_manager(),
85 driver)); 86 driver));
86 } 87 }
87 88
88 // Normally the WebContents will automatically delete the delegate, but here 89 // Normally the WebContents will automatically delete the delegate, but here
89 // the delegate is owned by this test, so we have to manually destroy. 90 // the delegate is owned by this test, so we have to manually destroy.
90 virtual void WebContentsDestroyed(content::WebContents* web_contents) 91 virtual void WebContentsDestroyed() OVERRIDE {
91 OVERRIDE {
92 DCHECK_EQ(web_contents_, web_contents);
93
94 autofill_external_delegate_.reset(); 92 autofill_external_delegate_.reset();
95 } 93 }
96 94
97 protected: 95 protected:
98 content::WebContents* web_contents_;
99
100 scoped_ptr<TestAutofillExternalDelegate> autofill_external_delegate_; 96 scoped_ptr<TestAutofillExternalDelegate> autofill_external_delegate_;
101 }; 97 };
102 98
103 // Autofill UI isn't currently hidden on window move on Mac. 99 // Autofill UI isn't currently hidden on window move on Mac.
104 // http://crbug.com/180566 100 // http://crbug.com/180566
105 #if !defined(OS_MACOSX) 101 #if !defined(OS_MACOSX)
106 IN_PROC_BROWSER_TEST_F(AutofillPopupControllerBrowserTest, 102 IN_PROC_BROWSER_TEST_F(AutofillPopupControllerBrowserTest,
107 HidePopupOnWindowConfiguration) { 103 HidePopupOnWindowConfiguration) {
108 GenerateTestAutofillPopup(autofill_external_delegate_.get()); 104 GenerateTestAutofillPopup(autofill_external_delegate_.get());
109 105
(...skipping 22 matching lines...) Expand all
132 MAYBE_DeleteDelegateBeforePopupHidden){ 128 MAYBE_DeleteDelegateBeforePopupHidden){
133 GenerateTestAutofillPopup(autofill_external_delegate_.get()); 129 GenerateTestAutofillPopup(autofill_external_delegate_.get());
134 130
135 // 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
136 // 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
137 // is hidden. See http://crbug.com/232475 133 // is hidden. See http://crbug.com/232475
138 autofill_external_delegate_.reset(); 134 autofill_external_delegate_.reset();
139 } 135 }
140 136
141 } // namespace autofill 137 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/auto_login_infobar_delegate.cc ('k') | chrome/browser/ui/autofill/tab_autofill_manager_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698