summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/extensions/extension_omnibox_apitest.cc12
-rw-r--r--chrome/browser/ui/gtk/browser_window_gtk.cc16
-rw-r--r--chrome/browser/ui/gtk/browser_window_gtk.h11
3 files changed, 35 insertions, 4 deletions
diff --git a/chrome/browser/extensions/extension_omnibox_apitest.cc b/chrome/browser/extensions/extension_omnibox_apitest.cc
index 34ee945..5daf3a6 100644
--- a/chrome/browser/extensions/extension_omnibox_apitest.cc
+++ b/chrome/browser/extensions/extension_omnibox_apitest.cc
@@ -22,6 +22,10 @@
#include "chrome/test/ui_test_utils.h"
#include "content/common/notification_type.h"
+#if defined(TOOLKIT_GTK)
+#include "chrome/browser/ui/gtk/browser_window_gtk.h"
+#endif
+
// Basic test is flaky on ChromeOS.
// http://crbug.com/52929
#if defined(OS_CHROMEOS)
@@ -86,6 +90,14 @@ IN_PROC_BROWSER_TEST_F(OmniboxApiTest, MAYBE_Basic) {
LocationBar* location_bar = GetLocationBar();
AutocompleteController* autocomplete_controller = GetAutocompleteController();
+#if defined(TOOLKIT_GTK)
+ // Disable the timer because, on Lucid at least, it triggers resize/move
+ // behavior in the browser window, which dismisses the autocomplete popup
+ // before the results can be read.
+ static_cast<BrowserWindowGtk*>(
+ browser()->window())->DisableDebounceTimerForTests(true);
+#endif
+
// Test that our extension's keyword is suggested to us when we partially type
// it.
{
diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc
index ca3509f..43cfae6 100644
--- a/chrome/browser/ui/gtk/browser_window_gtk.cc
+++ b/chrome/browser/ui/gtk/browser_window_gtk.cc
@@ -278,6 +278,7 @@ BrowserWindowGtk::BrowserWindowGtk(Browser* browser)
maximize_after_show_(false),
suppress_window_raise_(false),
accel_group_(NULL),
+ debounce_timer_disabled_(false),
infobar_arrow_model_(this) {
}
@@ -1327,10 +1328,11 @@ gboolean BrowserWindowGtk::OnConfigure(GtkWidget* widget,
// reconfigure event in a short while.
// We don't use Reset() because the timer may not yet be running.
// (In that case Stop() is a no-op.)
- window_configure_debounce_timer_.Stop();
- window_configure_debounce_timer_.Start(base::TimeDelta::FromMilliseconds(
- kDebounceTimeoutMilliseconds), this,
- &BrowserWindowGtk::OnDebouncedBoundsChanged);
+ if (!debounce_timer_disabled_)
+ window_configure_debounce_timer_.Stop();
+ window_configure_debounce_timer_.Start(base::TimeDelta::FromMilliseconds(
+ kDebounceTimeoutMilliseconds), this,
+ &BrowserWindowGtk::OnDebouncedBoundsChanged);
return FALSE;
}
@@ -1448,6 +1450,12 @@ bool BrowserWindowGtk::ShouldShowWindowIcon() const {
return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR);
}
+void BrowserWindowGtk::DisableDebounceTimerForTests(bool is_disabled) {
+ debounce_timer_disabled_ = is_disabled;
+ if (is_disabled)
+ window_configure_debounce_timer_.Stop();
+}
+
void BrowserWindowGtk::AddFindBar(FindBarGtk* findbar) {
gtk_floating_container_add_floating(
GTK_FLOATING_CONTAINER(render_area_floating_container_),
diff --git a/chrome/browser/ui/gtk/browser_window_gtk.h b/chrome/browser/ui/gtk/browser_window_gtk.h
index 0dcfa6e..d7509bb 100644
--- a/chrome/browser/ui/gtk/browser_window_gtk.h
+++ b/chrome/browser/ui/gtk/browser_window_gtk.h
@@ -166,6 +166,10 @@ class BrowserWindowGtk : public BrowserWindow,
bool ShouldShowWindowIcon() const;
+ // This should only be called from tests where the debounce timeout introduces
+ // timing issues.
+ void DisableDebounceTimerForTests(bool is_disabled);
+
// Add the find bar widget to the window hierarchy.
void AddFindBar(FindBarGtk* findbar);
@@ -499,6 +503,13 @@ class BrowserWindowGtk : public BrowserWindow,
scoped_ptr<FullscreenExitBubbleGtk> fullscreen_exit_bubble_;
+ // If true, the debounce timer won't be used and OnDebounceBoundsChanged won't
+ // be called. This should only be enabled in tests where the debounce timeout
+ // introduces timing issues (e.g. in OmniBoxApiTest it dismisses the
+ // autocomplete popup before the results can be read) and the final window
+ // position is unimportant.
+ bool debounce_timer_disabled_;
+
// The model that tracks the paint state of the arrow for the infobar
// directly below the toolbar.
InfoBarArrowModel infobar_arrow_model_;