summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/automation/automation_provider.cc15
-rw-r--r--chrome/browser/automation/automation_provider_gtk.cc7
-rw-r--r--chrome/browser/automation/automation_provider_mac.mm7
-rw-r--r--chrome/browser/automation/automation_provider_win.cc19
-rw-r--r--chrome/browser/browser_window.h3
-rw-r--r--chrome/browser/cocoa/browser_window_cocoa.h1
-rw-r--r--chrome/browser/cocoa/browser_window_cocoa.mm4
-rw-r--r--chrome/browser/cocoa/browser_window_controller.h3
-rw-r--r--chrome/browser/cocoa/browser_window_controller.mm4
-rw-r--r--chrome/browser/gtk/browser_window_gtk.cc6
-rw-r--r--chrome/browser/gtk/browser_window_gtk.h1
-rw-r--r--chrome/browser/views/frame/browser_view.cc7
-rw-r--r--chrome/browser/views/frame/browser_view.h1
-rw-r--r--chrome/test/functional/bookmark_bar.py23
-rw-r--r--chrome/test/pyautolib/pyautolib.cc13
-rw-r--r--chrome/test/pyautolib/pyautolib.h7
-rw-r--r--chrome/test/pyautolib/pyautolib.i5
-rw-r--r--chrome/test/test_browser_window.h1
18 files changed, 94 insertions, 33 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 8c1de8c..6a29cba 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -1266,6 +1266,21 @@ void AutomationProvider::HandleFindWindowLocationRequest(int handle, int* x,
*y = position.y();
}
+void AutomationProvider::GetBookmarkBarVisibility(int handle,
+ bool* visible,
+ bool* animating) {
+ *visible = false;
+ *animating = false;
+
+ if (browser_tracker_->ContainsHandle(handle)) {
+ Browser* browser = browser_tracker_->GetResource(handle);
+ if (browser) {
+ *visible = browser->window()->IsBookmarkBarVisible();
+ *animating = browser->window()->IsBookmarkBarAnimating();
+ }
+ }
+}
+
void AutomationProvider::HandleInspectElementRequest(
int handle, int x, int y, IPC::Message* reply_message) {
TabContents* tab_contents = GetTabContentsForHandle(handle, NULL);
diff --git a/chrome/browser/automation/automation_provider_gtk.cc b/chrome/browser/automation/automation_provider_gtk.cc
index eaed3b5..45623a2 100644
--- a/chrome/browser/automation/automation_provider_gtk.cc
+++ b/chrome/browser/automation/automation_provider_gtk.cc
@@ -92,13 +92,6 @@ void AutomationProvider::SetInitialFocus(const IPC::Message& message,
NOTIMPLEMENTED();
}
-void AutomationProvider::GetBookmarkBarVisibility(int handle, bool* visible,
- bool* animating) {
- *visible = false;
- *animating = false;
- NOTIMPLEMENTED();
-}
-
// This task sends a WindowDragResponse message with the appropriate
// routing ID to the automation proxy. This is implemented as a task so that
// we know that the mouse events (and any tasks that they spawn on the message
diff --git a/chrome/browser/automation/automation_provider_mac.mm b/chrome/browser/automation/automation_provider_mac.mm
index 78ac739..b475f4d 100644
--- a/chrome/browser/automation/automation_provider_mac.mm
+++ b/chrome/browser/automation/automation_provider_mac.mm
@@ -117,13 +117,6 @@ void AutomationProvider::SetInitialFocus(const IPC::Message& message,
NOTIMPLEMENTED();
}
-void AutomationProvider::GetBookmarkBarVisibility(int handle, bool* visible,
- bool* animating) {
- *visible = false;
- *animating = false;
- NOTIMPLEMENTED();
-}
-
void AutomationProvider::WindowSimulateDrag(int handle,
std::vector<gfx::Point> drag_path,
int flags,
diff --git a/chrome/browser/automation/automation_provider_win.cc b/chrome/browser/automation/automation_provider_win.cc
index d31836f9..ecdcd57 100644
--- a/chrome/browser/automation/automation_provider_win.cc
+++ b/chrome/browser/automation/automation_provider_win.cc
@@ -244,25 +244,6 @@ void AutomationProvider::GetFocusedViewID(int handle, int* view_id) {
}
}
-void AutomationProvider::GetBookmarkBarVisibility(int handle, bool* visible,
- bool* animating) {
- *visible = false;
- *animating = false;
-
- if (browser_tracker_->ContainsHandle(handle)) {
- Browser* browser = browser_tracker_->GetResource(handle);
- if (browser) {
- BrowserWindowTesting* testing =
- browser->window()->GetBrowserWindowTesting();
- BookmarkBarView* bookmark_bar = testing->GetBookmarkBarView();
- if (bookmark_bar) {
- *animating = bookmark_bar->IsAnimating();
- *visible = browser->window()->IsBookmarkBarVisible();
- }
- }
- }
-}
-
void AutomationProvider::GetWindowBounds(int handle, gfx::Rect* bounds,
bool* success) {
*success = false;
diff --git a/chrome/browser/browser_window.h b/chrome/browser/browser_window.h
index 152e7dc..d4cf1309 100644
--- a/chrome/browser/browser_window.h
+++ b/chrome/browser/browser_window.h
@@ -151,6 +151,9 @@ class BrowserWindow {
// Returns whether the bookmark bar is visible or not.
virtual bool IsBookmarkBarVisible() const = 0;
+ // Returns whether the bookmark bar is animating or not.
+ virtual bool IsBookmarkBarAnimating() const = 0;
+
// Returns whether the tool bar is visible or not.
virtual bool IsToolbarVisible() const = 0;
diff --git a/chrome/browser/cocoa/browser_window_cocoa.h b/chrome/browser/cocoa/browser_window_cocoa.h
index 2b5fb44..b0ace80 100644
--- a/chrome/browser/cocoa/browser_window_cocoa.h
+++ b/chrome/browser/cocoa/browser_window_cocoa.h
@@ -58,6 +58,7 @@ class BrowserWindowCocoa : public BrowserWindow,
bool should_restore_state);
virtual void FocusToolbar();
virtual bool IsBookmarkBarVisible() const;
+ virtual bool IsBookmarkBarAnimating() const;
virtual bool IsToolbarVisible() const;
virtual gfx::Rect GetRootWindowResizerRect() const;
virtual void ConfirmAddSearchProvider(const TemplateURL* template_url,
diff --git a/chrome/browser/cocoa/browser_window_cocoa.mm b/chrome/browser/cocoa/browser_window_cocoa.mm
index 2ebda45..42a68c8 100644
--- a/chrome/browser/cocoa/browser_window_cocoa.mm
+++ b/chrome/browser/cocoa/browser_window_cocoa.mm
@@ -241,6 +241,10 @@ bool BrowserWindowCocoa::IsBookmarkBarVisible() const {
return browser_->profile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar);
}
+bool BrowserWindowCocoa::IsBookmarkBarAnimating() const {
+ return [controller_ isBookmarkBarAnimating];
+}
+
bool BrowserWindowCocoa::IsToolbarVisible() const {
return browser_->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) ||
browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR);
diff --git a/chrome/browser/cocoa/browser_window_controller.h b/chrome/browser/cocoa/browser_window_controller.h
index 86d86ce..70f6a8a 100644
--- a/chrome/browser/cocoa/browser_window_controller.h
+++ b/chrome/browser/cocoa/browser_window_controller.h
@@ -182,6 +182,9 @@ class TabStripModelObserverBridge;
- (BOOL)isBookmarkBarVisible;
+// Returns YES if the bookmark bar is currently animating.
+- (BOOL)isBookmarkBarAnimating;
+
// Called after bookmark bar visibility changes (due to pref change or change in
// tab/tab contents).
- (void)updateBookmarkBarVisibilityWithAnimation:(BOOL)animate;
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm
index 04b17a2..55f15d4 100644
--- a/chrome/browser/cocoa/browser_window_controller.mm
+++ b/chrome/browser/cocoa/browser_window_controller.mm
@@ -1197,6 +1197,10 @@
return [bookmarkBarController_ isVisible];
}
+- (BOOL)isBookmarkBarAnimating {
+ return [bookmarkBarController_ isAnimationRunning];
+}
+
- (void)updateBookmarkBarVisibilityWithAnimation:(BOOL)animate {
[bookmarkBarController_
updateAndShowNormalBar:[self shouldShowBookmarkBar]
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc
index 2de3b84..6bcb176 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -787,6 +787,12 @@ bool BrowserWindowGtk::IsBookmarkBarVisible() const {
bookmark_bar_.get();
}
+bool BrowserWindowGtk::IsBookmarkBarAnimating() const {
+ if (IsBookmarkBarSupported() && bookmark_bar_->IsAnimating())
+ return true;
+ return false;
+}
+
bool BrowserWindowGtk::IsToolbarVisible() const {
return IsToolbarSupported();
}
diff --git a/chrome/browser/gtk/browser_window_gtk.h b/chrome/browser/gtk/browser_window_gtk.h
index 1cbfab0..18ba31f 100644
--- a/chrome/browser/gtk/browser_window_gtk.h
+++ b/chrome/browser/gtk/browser_window_gtk.h
@@ -76,6 +76,7 @@ class BrowserWindowGtk : public BrowserWindow,
bool should_restore_state);
virtual void FocusToolbar();
virtual bool IsBookmarkBarVisible() const;
+ virtual bool IsBookmarkBarAnimating() const;
virtual bool IsToolbarVisible() const;
virtual gfx::Rect GetRootWindowResizerRect() const;
virtual void ConfirmAddSearchProvider(const TemplateURL* template_url,
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index 7e7aece..0948c96 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -893,6 +893,13 @@ bool BrowserView::IsBookmarkBarVisible() const {
(active_bookmark_bar_->GetPreferredSize().height() != 0);
}
+bool BrowserView::IsBookmarkBarAnimating() const {
+ if (bookmark_bar_view_.get() &&
+ bookmark_bar_view_->IsAnimating())
+ return true;
+ return false;
+}
+
bool BrowserView::IsToolbarVisible() const {
return browser_->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) ||
browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR);
diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h
index f2d1978..e683fdf 100644
--- a/chrome/browser/views/frame/browser_view.h
+++ b/chrome/browser/views/frame/browser_view.h
@@ -265,6 +265,7 @@ class BrowserView : public BrowserBubbleHost,
virtual void FocusToolbar();
virtual void DestroyBrowser();
virtual bool IsBookmarkBarVisible() const;
+ virtual bool IsBookmarkBarAnimating() const;
virtual bool IsToolbarVisible() const;
virtual gfx::Rect GetRootWindowResizerRect() const;
virtual void DisableInactiveFrame();
diff --git a/chrome/test/functional/bookmark_bar.py b/chrome/test/functional/bookmark_bar.py
new file mode 100644
index 0000000..a91113f
--- /dev/null
+++ b/chrome/test/functional/bookmark_bar.py
@@ -0,0 +1,23 @@
+#!/usr/bin/python
+# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import unittest
+
+import pyauto
+
+class BookmarkBarTest(pyauto.PyUITest):
+ """Test of bookmark bar toggling, visibility, and animation."""
+
+ def testBookmarkBarVisible(self):
+ """Open and close the bookmark bar, confirming visibility at each step."""
+ self.assertFalse(self.GetBookmarkBarVisibility())
+ self.ApplyAccelerator(pyauto.IDC_SHOW_BOOKMARK_BAR)
+ self.assertTrue(self.GetBookmarkBarVisibility())
+ self.ApplyAccelerator(pyauto.IDC_SHOW_BOOKMARK_BAR)
+ self.assertFalse(self.GetBookmarkBarVisibility())
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/chrome/test/pyautolib/pyautolib.cc b/chrome/test/pyautolib/pyautolib.cc
index ebfb565..7a9efc9 100644
--- a/chrome/test/pyautolib/pyautolib.cc
+++ b/chrome/test/pyautolib/pyautolib.cc
@@ -116,3 +116,16 @@ bool PyUITestSuite::InstallExtension(const FilePath& crx_file) {
return automation()->InstallExtension(crx_file);
}
+bool PyUITestSuite::GetBookmarkBarVisibility() {
+ scoped_refptr<BrowserProxy> browser_proxy =
+ automation()->GetBrowserWindow(0); // Window doesn't matter.
+ EXPECT_TRUE(browser_proxy.get());
+ if (!browser_proxy.get())
+ return false;
+
+ // We have no use for animating in this context.
+ bool visible, animating;
+ EXPECT_TRUE(browser_proxy->GetBookmarkBarVisibility(&visible, &animating));
+ return visible;
+}
+
diff --git a/chrome/test/pyautolib/pyautolib.h b/chrome/test/pyautolib/pyautolib.h
index 767b2bd..0833e2a 100644
--- a/chrome/test/pyautolib/pyautolib.h
+++ b/chrome/test/pyautolib/pyautolib.h
@@ -83,6 +83,13 @@ class PyUITestSuite : public UITestSuite, public UITestBase {
// and loaded successfully. Overinstalls will fail.
bool InstallExtension(const FilePath& crx_file);
+ // Returns bookmark bar visibility state.
+ bool GetBookmarkBarVisibility();
+
+ // Returns bookmark bar animation state. Warning: timing issues may
+ // change this return value unexpectedly.
+ bool IsBookmarkBarAnimating();
+
private:
base::ScopedNSAutoreleasePool pool_;
};
diff --git a/chrome/test/pyautolib/pyautolib.i b/chrome/test/pyautolib/pyautolib.i
index 631317f..c406005 100644
--- a/chrome/test/pyautolib/pyautolib.i
+++ b/chrome/test/pyautolib/pyautolib.i
@@ -123,6 +123,11 @@ class PyUITestSuite {
"given or first browser window.") IsDownloadShelfVisible;
bool IsDownloadShelfVisible(int window_index=0);
+ %feature("docstring", "Determine if the bookmark bar is visible. "
+ "If the NTP is visible, only return true if attached "
+ "(to the chrome).") GetBookmarkBarVisibility;
+ bool GetBookmarkBarVisibility();
+
%feature("docstring", "Open the Find box in the given or first browser "
"window.") OpenFindInPage;
void OpenFindInPage(int window_index=0);
diff --git a/chrome/test/test_browser_window.h b/chrome/test/test_browser_window.h
index e1a1be1..169afdb 100644
--- a/chrome/test/test_browser_window.h
+++ b/chrome/test/test_browser_window.h
@@ -61,6 +61,7 @@ class TestBrowserWindow : public BrowserWindow {
#endif // defined(TOOLKIT_VIEWS)
virtual bool IsBookmarkBarVisible() const { return false; }
+ virtual bool IsBookmarkBarAnimating() const { return false; }
virtual bool IsToolbarVisible() const { return false; }
virtual gfx::Rect GetRootWindowResizerRect() const { return gfx::Rect(); }
virtual void ConfirmAddSearchProvider(const TemplateURL* template_url,