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

Unified Diff: chrome/browser/autofill/autofill_browsertest.cc

Issue 17225008: Eliminate AutofillExternalDelegate being a WebContentsUserData (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Response to review Created 7 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/autofill/autofill_interactive_uitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/autofill_browsertest.cc
diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc
index ff5bd4a43b6e564eea7b93b356a545760d27581e..d2d213fd4fe0901a145bb8e70e95ee28190f4d29 100644
--- a/chrome/browser/autofill/autofill_browsertest.cc
+++ b/chrome/browser/autofill/autofill_browsertest.cc
@@ -229,12 +229,13 @@ class AutofillTest : public InProcessBrowserTest {
// allows us to forward keyboard events to the popup directly.
content::WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents();
- AutofillManager* autofill_manager =
- AutofillDriverImpl::FromWebContents(web_contents)->autofill_manager();
+ AutofillDriverImpl* autofill_driver =
+ AutofillDriverImpl::FromWebContents(web_contents);
+ AutofillManager* autofill_manager = autofill_driver->autofill_manager();
if (autofill_manager->IsNativeUiEnabled()) {
- external_delegate_.reset(
+ scoped_ptr<AutofillExternalDelegate> external_delegate(
new TestAutofillExternalDelegate(web_contents, autofill_manager));
- autofill_manager->SetExternalDelegate(external_delegate_.get());
+ autofill_driver->SetAutofillExternalDelegate(external_delegate.Pass());
}
autofill_manager->SetTestDelegate(&test_delegate_);
}
@@ -472,7 +473,7 @@ class AutofillTest : public InProcessBrowserTest {
void SendKeyToPopupAndWait(ui::KeyboardCode key) {
// TODO(isherman): Remove this condition once the WebKit popup UI code is
// removed.
- if (!external_delegate_) {
+ if (!external_delegate()) {
// When testing the WebKit-based UI, route all keys to the page.
SendKeyToPageAndWait(key);
return;
@@ -483,7 +484,7 @@ class AutofillTest : public InProcessBrowserTest {
content::NativeWebKeyboardEvent event;
event.windowsKeyCode = key;
test_delegate_.Reset();
- external_delegate_->keyboard_listener()->HandleKeyPressEvent(event);
+ external_delegate()->keyboard_listener()->HandleKeyPressEvent(event);
test_delegate_.Wait();
}
@@ -522,14 +523,18 @@ class AutofillTest : public InProcessBrowserTest {
}
TestAutofillExternalDelegate* external_delegate() {
- return external_delegate_.get();
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ AutofillDriverImpl* autofill_driver =
+ AutofillDriverImpl::FromWebContents(web_contents);
+ return static_cast<TestAutofillExternalDelegate*>(
+ autofill_driver->autofill_external_delegate());
}
AutofillManagerTestDelegateImpl test_delegate_;
private:
net::TestURLFetcherFactory url_fetcher_factory_;
- scoped_ptr<TestAutofillExternalDelegate> external_delegate_;
};
// http://crbug.com/150084
« no previous file with comments | « no previous file | chrome/browser/autofill/autofill_interactive_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698