summaryrefslogtreecommitdiffstats
path: root/chrome/browser/app_modal_dialog.cc
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-10 19:33:18 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-10 19:33:18 +0000
commita1d5396ed9f2101d021031675eab55aafb3a2894 (patch)
tree256d3e518348bbc962075591a9922720422f3dd8 /chrome/browser/app_modal_dialog.cc
parent7a2a9ce8a5fd79c2fbb5bf3db7a7d58bbd73ce80 (diff)
downloadchromium_src-a1d5396ed9f2101d021031675eab55aafb3a2894.zip
chromium_src-a1d5396ed9f2101d021031675eab55aafb3a2894.tar.gz
chromium_src-a1d5396ed9f2101d021031675eab55aafb3a2894.tar.bz2
Convert JavascriptAlertActivatesTab to browser_tests framework.
This should make it non-flaky, so I un-disabled the test. I also added necessary plumbing so we can wait for AppModalDialog to appear and close it. TEST=Covered by browser_tests. http://crbug.com/16062 Review URL: http://codereview.chromium.org/149460 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20400 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/app_modal_dialog.cc')
-rw-r--r--chrome/browser/app_modal_dialog.cc24
1 files changed, 21 insertions, 3 deletions
diff --git a/chrome/browser/app_modal_dialog.cc b/chrome/browser/app_modal_dialog.cc
index afabff8..aa876cc 100644
--- a/chrome/browser/app_modal_dialog.cc
+++ b/chrome/browser/app_modal_dialog.cc
@@ -50,6 +50,13 @@ void AppModalDialog::Observe(NotificationType type,
CloseModalDialog();
}
+void AppModalDialog::SendCloseNotification() {
+ NotificationService::current()->Notify(
+ NotificationType::APP_MODAL_DIALOG_CLOSED,
+ Source<AppModalDialog>(this),
+ NotificationService::NoDetails());
+}
+
void AppModalDialog::InitNotifications() {
// Make sure we get navigation notifications so we know when our parent
// contents will disappear or navigate to a different page.
@@ -70,6 +77,11 @@ void AppModalDialog::ShowModalDialog() {
tab_contents_->Activate();
CreateAndShowDialog();
+
+ NotificationService::current()->Notify(
+ NotificationType::APP_MODAL_DIALOG_SHOWN,
+ Source<AppModalDialog>(this),
+ NotificationService::NoDetails());
}
void AppModalDialog::OnCancel() {
@@ -85,6 +97,8 @@ void AppModalDialog::OnCancel() {
tab_contents_->OnJavaScriptMessageBoxClosed(reply_msg_, false,
std::wstring());
}
+
+ SendCloseNotification();
}
void AppModalDialog::OnAccept(const std::wstring& prompt_text,
@@ -98,10 +112,14 @@ void AppModalDialog::OnAccept(const std::wstring& prompt_text,
if (suppress_js_messages)
tab_contents()->set_suppress_javascript_messages(true);
}
+
+ SendCloseNotification();
}
void AppModalDialog::OnClose() {
- if (tab_contents_) {
- tab_contents_->OnJavaScriptMessageBoxWindowDestroyed();
- }
+ if (tab_contents_) {
+ tab_contents_->OnJavaScriptMessageBoxWindowDestroyed();
+ }
+
+ SendCloseNotification();
}