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

Side by Side Diff: chrome/browser/autofill/content_autofill_driver_browsertest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "chrome/browser/browser_process.h" 6 #include "chrome/browser/browser_process.h"
7 #include "chrome/browser/ui/browser.h" 7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/browser_tabstrip.h" 8 #include "chrome/browser/ui/browser_tabstrip.h"
9 #include "chrome/browser/ui/tabs/tab_strip_model.h" 9 #include "chrome/browser/ui/tabs/tab_strip_model.h"
10 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 } // namespace 75 } // namespace
76 76
77 class ContentAutofillDriverBrowserTest : public InProcessBrowserTest, 77 class ContentAutofillDriverBrowserTest : public InProcessBrowserTest,
78 public content::WebContentsObserver { 78 public content::WebContentsObserver {
79 public: 79 public:
80 ContentAutofillDriverBrowserTest() {} 80 ContentAutofillDriverBrowserTest() {}
81 virtual ~ContentAutofillDriverBrowserTest() {} 81 virtual ~ContentAutofillDriverBrowserTest() {}
82 82
83 virtual void SetUpOnMainThread() OVERRIDE { 83 virtual void SetUpOnMainThread() OVERRIDE {
84 web_contents_ = browser()->tab_strip_model()->GetActiveWebContents(); 84 content::WebContents* web_contents =
85 ASSERT_TRUE(web_contents_ != NULL); 85 browser()->tab_strip_model()->GetActiveWebContents();
86 Observe(web_contents_); 86 ASSERT_TRUE(web_contents != NULL);
87 Observe(web_contents);
87 AutofillManager::RegisterProfilePrefs(manager_delegate_.GetPrefRegistry()); 88 AutofillManager::RegisterProfilePrefs(manager_delegate_.GetPrefRegistry());
88 89
89 autofill_driver_.reset( 90 autofill_driver_.reset(
90 new TestContentAutofillDriver(web_contents_, &manager_delegate_)); 91 new TestContentAutofillDriver(web_contents, &manager_delegate_));
91 } 92 }
92 93
93 // Normally the WebContents will automatically delete the driver, but here 94 // Normally the WebContents will automatically delete the driver, but here
94 // the driver is owned by this test, so we have to manually destroy. 95 // the driver is owned by this test, so we have to manually destroy.
95 virtual void WebContentsDestroyed(content::WebContents* web_contents) 96 virtual void WebContentsDestroyed() OVERRIDE {
96 OVERRIDE {
97 DCHECK_EQ(web_contents_, web_contents);
98 autofill_driver_.reset(); 97 autofill_driver_.reset();
99 } 98 }
100 99
101 virtual void WasHidden() OVERRIDE { 100 virtual void WasHidden() OVERRIDE {
102 if (!web_contents_hidden_callback_.is_null()) 101 if (!web_contents_hidden_callback_.is_null())
103 web_contents_hidden_callback_.Run(); 102 web_contents_hidden_callback_.Run();
104 } 103 }
105 104
106 virtual void NavigationEntryCommitted( 105 virtual void NavigationEntryCommitted(
107 const content::LoadCommittedDetails& load_details) OVERRIDE { 106 const content::LoadCommittedDetails& load_details) OVERRIDE {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 browser()->OpenURL(content::OpenURLParams(GURL(chrome::kChromeUIAboutURL), 153 browser()->OpenURL(content::OpenURLParams(GURL(chrome::kChromeUIAboutURL),
155 content::Referrer(), 154 content::Referrer(),
156 CURRENT_TAB, 155 CURRENT_TAB,
157 content::PAGE_TRANSITION_TYPED, 156 content::PAGE_TRANSITION_TYPED,
158 false)); 157 false));
159 runner->Run(); 158 runner->Run();
160 nav_entry_committed_callback_.Reset(); 159 nav_entry_committed_callback_.Reset();
161 } 160 }
162 161
163 } // namespace autofill 162 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/apps/ephemeral_app_launcher.cc ('k') | chrome/browser/chromeos/file_manager/app_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698