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

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: Removed what was added in https://codereview.chromium.org/239393009 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()
91 OVERRIDE { 92 OVERRIDE {
jam 2014/05/05 17:46:46 nit: move override to previous line
zverre 2014/05/06 09:37:26 Done.
92 DCHECK_EQ(web_contents_, web_contents);
93
94 autofill_external_delegate_.reset(); 93 autofill_external_delegate_.reset();
95 } 94 }
96 95
97 protected: 96 protected:
98 content::WebContents* web_contents_;
99
100 scoped_ptr<TestAutofillExternalDelegate> autofill_external_delegate_; 97 scoped_ptr<TestAutofillExternalDelegate> autofill_external_delegate_;
101 }; 98 };
102 99
103 // Autofill UI isn't currently hidden on window move on Mac. 100 // Autofill UI isn't currently hidden on window move on Mac.
104 // http://crbug.com/180566 101 // http://crbug.com/180566
105 #if !defined(OS_MACOSX) 102 #if !defined(OS_MACOSX)
106 IN_PROC_BROWSER_TEST_F(AutofillPopupControllerBrowserTest, 103 IN_PROC_BROWSER_TEST_F(AutofillPopupControllerBrowserTest,
107 HidePopupOnWindowConfiguration) { 104 HidePopupOnWindowConfiguration) {
108 GenerateTestAutofillPopup(autofill_external_delegate_.get()); 105 GenerateTestAutofillPopup(autofill_external_delegate_.get());
109 106
(...skipping 22 matching lines...) Expand all
132 MAYBE_DeleteDelegateBeforePopupHidden){ 129 MAYBE_DeleteDelegateBeforePopupHidden){
133 GenerateTestAutofillPopup(autofill_external_delegate_.get()); 130 GenerateTestAutofillPopup(autofill_external_delegate_.get());
134 131
135 // Delete the external delegate here so that is gets deleted before popup is 132 // 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 133 // hidden. This can happen if the web_contents are destroyed before the popup
137 // is hidden. See http://crbug.com/232475 134 // is hidden. See http://crbug.com/232475
138 autofill_external_delegate_.reset(); 135 autofill_external_delegate_.reset();
139 } 136 }
140 137
141 } // namespace autofill 138 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698