summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorrafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-17 22:32:16 +0000
committerrafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-17 22:32:16 +0000
commit9181d3e491ff88dab0dfa99f5f2b77a67c1316e7 (patch)
treee2eaa2f6afcc81c0e99891fd40aca7c48a8e945e /chrome/browser
parent7f998eba8ae7e97c40112a8260ed76550c570c52 (diff)
downloadchromium_src-9181d3e491ff88dab0dfa99f5f2b77a67c1316e7.zip
chromium_src-9181d3e491ff88dab0dfa99f5f2b77a67c1316e7.tar.gz
chromium_src-9181d3e491ff88dab0dfa99f5f2b77a67c1316e7.tar.bz2
Fix for ExtensionApiTest.Popup flakiness
This fires the OnPopupClosed event in a later event via PostTask. This gives the popup time to complete closing before the OnPopupClosed is received by the extension BUG=NONE TEST=NONE Review URL: http://codereview.chromium.org/1041004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41888 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/extensions/extension_popup_api.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/chrome/browser/extensions/extension_popup_api.cc b/chrome/browser/extensions/extension_popup_api.cc
index 504a7a07..d8d7262 100644
--- a/chrome/browser/extensions/extension_popup_api.cc
+++ b/chrome/browser/extensions/extension_popup_api.cc
@@ -72,7 +72,7 @@ class ExtensionPopupHost : public ExtensionPopup::Observer,
public:
explicit ExtensionPopupHost(ExtensionFunctionDispatcher* dispatcher)
: dispatcher_(dispatcher), popup_(NULL) {
- AddRef(); // Balanced in ExtensionPopupClosed().
+ AddRef(); // Balanced in DispatchPopupClosedEvent().
views::FocusManager::GetWidgetFocusManager()->AddFocusChangeListener(this);
}
@@ -87,6 +87,13 @@ class ExtensionPopupHost : public ExtensionPopup::Observer,
// Overriden from ExtensionPopup::Observer
virtual void ExtensionPopupClosed(ExtensionPopup* popup) {
+ // The OnPopupClosed event should be sent later to give the popup time to
+ // complete closing.
+ MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(this,
+ &ExtensionPopupHost::DispatchPopupClosedEvent));
+ }
+
+ virtual void DispatchPopupClosedEvent() {
RenderViewHost* render_view_host = dispatcher_->GetExtensionHost() ?
dispatcher_->GetExtensionHost()->render_view_host() :
dispatcher_->GetExtensionDOMUI()->GetRenderViewHost();