Index: chrome/browser/autofill/autofill_interactive_uitest.cc |
=================================================================== |
--- chrome/browser/autofill/autofill_interactive_uitest.cc (revision 212931) |
+++ chrome/browser/autofill/autofill_interactive_uitest.cc (working copy) |
@@ -74,6 +74,7 @@ |
public: |
AutofillManagerTestDelegateImpl() {} |
+ // autofill::AutofillManagerTestDelegate: |
virtual void DidPreviewFormData() OVERRIDE { |
loop_runner_->Quit(); |
} |
@@ -120,15 +121,6 @@ |
infobar_service_->RemoveInfoBar(infobar_service_->infobar_at(0)); |
} |
- void Wait() { |
- if (!alerted_) { |
- has_run_message_loop_ = true; |
- content::RunMessageLoop(); |
- } |
- PersonalDataManagerFactory::GetForProfile(browser_->profile())-> |
- RemoveObserver(this); |
- } |
- |
// PersonalDataManagerObserver: |
virtual void OnPersonalDataChanged() OVERRIDE { |
if (has_run_message_loop_) { |
@@ -156,6 +148,15 @@ |
confirm_infobar->Accept(); |
} |
+ void Wait() { |
+ if (!alerted_) { |
+ has_run_message_loop_ = true; |
+ content::RunMessageLoop(); |
+ } |
+ PersonalDataManagerFactory::GetForProfile(browser_->profile())-> |
+ RemoveObserver(this); |
+ } |
+ |
private: |
bool alerted_; |
bool has_run_message_loop_; |
@@ -175,6 +176,7 @@ |
} |
virtual ~TestAutofillExternalDelegate() {} |
+ // AutofillExternalDelegate: |
virtual void OnPopupShown(content::KeyboardListener* listener) OVERRIDE { |
AutofillExternalDelegate::OnPopupShown(listener); |
keyboard_listener_ = listener; |
@@ -201,6 +203,7 @@ |
protected: |
AutofillInteractiveTest() {} |
+ // InProcessBrowserTest: |
virtual void SetUpOnMainThread() OVERRIDE { |
// Don't want Keychain coming up on Mac. |
test::DisableSystemServices(browser()->profile()); |
@@ -228,10 +231,24 @@ |
autofill_manager->delegate()->HideAutofillPopup(); |
} |
- PersonalDataManager* personal_data_manager() { |
+ PersonalDataManager* GetPersonalDataManager() { |
return PersonalDataManagerFactory::GetForProfile(browser()->profile()); |
} |
+ content::RenderViewHost* GetRenderViewHost() { |
+ return browser()->tab_strip_model()->GetActiveWebContents()-> |
+ GetRenderViewHost(); |
+ } |
+ |
+ TestAutofillExternalDelegate* GetExternalDelegate() { |
+ 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()); |
+ } |
+ |
void CreateTestProfile() { |
AutofillProfile profile; |
test::SetProfileInfo( |
@@ -240,7 +257,7 @@ |
"Basement", "Austin", "Texas", "78744", "US", "5125551234"); |
WindowedPersonalDataManagerObserver observer(browser()); |
- personal_data_manager()->AddProfile(profile); |
+ GetPersonalDataManager()->AddProfile(profile); |
// AddProfile is asynchronous. Wait for it to finish before continuing the |
// tests. |
@@ -258,11 +275,6 @@ |
EXPECT_EQ(expected_value, value); |
} |
- RenderViewHost* render_view_host() { |
- return browser()->tab_strip_model()->GetActiveWebContents()-> |
- GetRenderViewHost(); |
- } |
- |
void FocusFirstNameField() { |
LOG(WARNING) << "Clicking on the tab."; |
content::SimulateMouseClick( |
@@ -273,7 +285,7 @@ |
LOG(WARNING) << "Focusing the first name field."; |
bool result = false; |
ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
- render_view_host(), |
+ GetRenderViewHost(), |
"if (document.readyState === 'complete')" |
" document.getElementById('firstname').focus();" |
"else" |
@@ -305,7 +317,7 @@ |
void SendKeyToPopupAndWait(ui::KeyboardCode key) { |
// TODO(isherman): Remove this condition once the WebKit popup UI code is |
// removed. |
- if (!external_delegate()) { |
+ if (!GetExternalDelegate()) { |
// When testing the WebKit-based UI, route all keys to the page. |
SendKeyToPageAndWait(key); |
return; |
@@ -316,19 +328,10 @@ |
content::NativeWebKeyboardEvent event; |
event.windowsKeyCode = key; |
test_delegate_.Reset(); |
- external_delegate()->keyboard_listener()->HandleKeyPressEvent(event); |
+ GetExternalDelegate()->keyboard_listener()->HandleKeyPressEvent(event); |
test_delegate_.Wait(); |
} |
- TestAutofillExternalDelegate* external_delegate() { |
- 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_; |
}; |