summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authordyu@chromium.org <dyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-21 01:16:57 +0000
committerdyu@chromium.org <dyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-21 01:16:57 +0000
commit4a2def688dcdcd2c158de2fc1445059421af4eec (patch)
treef9d5ed8dd8600b6de2b67bca583067670253c554 /chrome
parent795e69a69bc608c827cbb91b32ecacc6d318af75 (diff)
downloadchromium_src-4a2def688dcdcd2c158de2fc1445059421af4eec.zip
chromium_src-4a2def688dcdcd2c158de2fc1445059421af4eec.tar.gz
chromium_src-4a2def688dcdcd2c158de2fc1445059421af4eec.tar.bz2
Add a type for the password infobar to support test automation.
The infobar type information is accessible via the GetBrowserInfo automation hook. Having infobar_type information accessible by automated tests will help make the tests more robust by identifying a particular infobar displayed. Currently, the tests identify infobars by other properties such as text displayed on the infobar, default infobar index, or text on infobar button, which are fragile. TEST=none BUG=none Review URL: http://codereview.chromium.org/9718011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127861 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc4
-rw-r--r--chrome/browser/infobars/infobar_delegate.cc4
-rw-r--r--chrome/browser/infobars/infobar_delegate.h2
-rw-r--r--chrome/browser/password_manager_delegate_impl.cc7
4 files changed, 16 insertions, 1 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index f9ee0f3..2b6240a 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -2710,7 +2710,9 @@ ListValue* TestingAutomationProvider::GetInfobarsInfo(WebContents* wc) {
InfoBarDelegate* infobar = infobar_helper->GetInfoBarDelegateAt(i);
if (infobar->AsConfirmInfoBarDelegate()) {
// Also covers ThemeInstalledInfoBarDelegate.
- if (infobar->AsRegisterProtocolHandlerInfoBarDelegate()) {
+ if (infobar->AsSavePasswordInfoBarDelegate()) {
+ infobar_item->SetString("type", "password_infobar");
+ } else if (infobar->AsRegisterProtocolHandlerInfoBarDelegate()) {
infobar_item->SetString("type", "rph_infobar");
} else {
infobar_item->SetString("type", "confirm_infobar");
diff --git a/chrome/browser/infobars/infobar_delegate.cc b/chrome/browser/infobars/infobar_delegate.cc
index 25a65ce..8c32823 100644
--- a/chrome/browser/infobars/infobar_delegate.cc
+++ b/chrome/browser/infobars/infobar_delegate.cc
@@ -67,6 +67,10 @@ MediaStreamInfoBarDelegate* InfoBarDelegate::AsMediaStreamInfobarDelegate() {
return NULL;
}
+SavePasswordInfoBarDelegate* InfoBarDelegate::AsSavePasswordInfoBarDelegate() {
+ return NULL;
+}
+
RegisterProtocolHandlerInfoBarDelegate*
InfoBarDelegate::AsRegisterProtocolHandlerInfoBarDelegate() {
return NULL;
diff --git a/chrome/browser/infobars/infobar_delegate.h b/chrome/browser/infobars/infobar_delegate.h
index 3dcda68..6c0e624 100644
--- a/chrome/browser/infobars/infobar_delegate.h
+++ b/chrome/browser/infobars/infobar_delegate.h
@@ -19,6 +19,7 @@ class LinkInfoBarDelegate;
class MediaStreamInfoBarDelegate;
class PluginInstallerInfoBarDelegate;
class RegisterProtocolHandlerInfoBarDelegate;
+class SavePasswordInfoBarDelegate;
class ThemeInstalledInfoBarDelegate;
class TranslateInfoBarDelegate;
@@ -92,6 +93,7 @@ class InfoBarDelegate {
virtual MediaStreamInfoBarDelegate* AsMediaStreamInfobarDelegate();
virtual RegisterProtocolHandlerInfoBarDelegate*
AsRegisterProtocolHandlerInfoBarDelegate();
+ virtual SavePasswordInfoBarDelegate* AsSavePasswordInfoBarDelegate();
virtual ThemeInstalledInfoBarDelegate* AsThemePreviewInfobarDelegate();
virtual TranslateInfoBarDelegate* AsTranslateInfoBarDelegate();
diff --git a/chrome/browser/password_manager_delegate_impl.cc b/chrome/browser/password_manager_delegate_impl.cc
index 594fdab..86839fa 100644
--- a/chrome/browser/password_manager_delegate_impl.cc
+++ b/chrome/browser/password_manager_delegate_impl.cc
@@ -53,6 +53,9 @@ class SavePasswordInfoBarDelegate : public ConfirmInfoBarDelegate {
virtual bool Accept() OVERRIDE;
virtual bool Cancel() OVERRIDE;
+ virtual SavePasswordInfoBarDelegate*
+ AsSavePasswordInfoBarDelegate() OVERRIDE;
+
// The PasswordFormManager managing the form we're asking the user about,
// and should update as per her decision.
scoped_ptr<PasswordFormManager> form_to_save_;
@@ -109,6 +112,10 @@ bool SavePasswordInfoBarDelegate::Cancel() {
return true;
}
+SavePasswordInfoBarDelegate*
+SavePasswordInfoBarDelegate::AsSavePasswordInfoBarDelegate() {
+ return this;
+}
// PasswordManagerDelegateImpl ------------------------------------------------