diff options
author | craigdh@chromium.org <craigdh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-13 22:59:03 +0000 |
---|---|---|
committer | craigdh@chromium.org <craigdh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-13 22:59:03 +0000 |
commit | 9329d68c95459fd0089bf66d4b6cbe5b046b882d (patch) | |
tree | 115a4c092a6274f1618684115e8e0fb0da0f81e0 /chrome/test | |
parent | d1198fdc8cced343476dbe03ebe108fd44d85309 (diff) | |
download | chromium_src-9329d68c95459fd0089bf66d4b6cbe5b046b882d.zip chromium_src-9329d68c95459fd0089bf66d4b6cbe5b046b882d.tar.gz chromium_src-9329d68c95459fd0089bf66d4b6cbe5b046b882d.tar.bz2 |
Final set of conversions of automation calls to the JSON interface.
Converts the old bookmark automation commands.
TEST=PyAuto CONTINUOUS suite
BUG=132794
Review URL: https://chromiumcodereview.appspot.com/10828245
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151380 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r-- | chrome/test/automation/browser_proxy.cc | 103 | ||||
-rw-r--r-- | chrome/test/automation/browser_proxy.h | 29 | ||||
-rwxr-xr-x | chrome/test/pyautolib/pyauto.py | 293 | ||||
-rw-r--r-- | chrome/test/pyautolib/pyautolib.cc | 137 | ||||
-rw-r--r-- | chrome/test/pyautolib/pyautolib.h | 44 | ||||
-rw-r--r-- | chrome/test/pyautolib/pyautolib.i | 53 | ||||
-rw-r--r-- | chrome/test/reliability/automated_ui_test_base.cc | 21 | ||||
-rw-r--r-- | chrome/test/reliability/automated_ui_test_base.h | 4 | ||||
-rw-r--r-- | chrome/test/reliability/automated_ui_tests.cc | 2 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.cc | 21 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.h | 6 |
11 files changed, 293 insertions, 420 deletions
diff --git a/chrome/test/automation/browser_proxy.cc b/chrome/test/automation/browser_proxy.cc index 2d6ac92a..6716da7 100644 --- a/chrome/test/automation/browser_proxy.cc +++ b/chrome/test/automation/browser_proxy.cc @@ -244,109 +244,6 @@ bool BrowserProxy::RunCommand(int browser_command) const { return result; } -bool BrowserProxy::GetBookmarkBarVisibility(bool* is_visible, - bool* is_animating, - bool* is_detached) { - if (!is_valid()) - return false; - - if (!is_visible || !is_animating) { - NOTREACHED(); - return false; - } - - return sender_->Send(new AutomationMsg_BookmarkBarVisibility( - handle_, is_visible, is_animating, is_detached)); -} - -bool BrowserProxy::GetBookmarksAsJSON(std::string *json_string) { - if (!is_valid()) - return false; - - if (!WaitForBookmarkModelToLoad()) - return false; - - bool result = false; - sender_->Send(new AutomationMsg_GetBookmarksAsJSON(handle_, - json_string, - &result)); - return result; -} - -bool BrowserProxy::WaitForBookmarkModelToLoad() { - if (!is_valid()) - return false; - - bool result = false; - sender_->Send(new AutomationMsg_WaitForBookmarkModelToLoad(handle_, &result)); - return result; -} - -bool BrowserProxy::AddBookmarkGroup(int64 parent_id, int index, - std::wstring& title) { - if (!is_valid()) - return false; - bool result = false; - sender_->Send(new AutomationMsg_AddBookmarkGroup(handle_, - parent_id, index, - title, - &result)); - return result; -} - -bool BrowserProxy::AddBookmarkURL(int64 parent_id, int index, - std::wstring& title, const GURL& url) { - if (!is_valid()) - return false; - bool result = false; - sender_->Send(new AutomationMsg_AddBookmarkURL(handle_, - parent_id, index, - title, url, - &result)); - return result; -} - -bool BrowserProxy::ReparentBookmark(int64 id, int64 new_parent_id, int index) { - if (!is_valid()) - return false; - bool result = false; - sender_->Send(new AutomationMsg_ReparentBookmark(handle_, - id, new_parent_id, - index, - &result)); - return result; -} - -bool BrowserProxy::SetBookmarkTitle(int64 id, const std::wstring& title) { - if (!is_valid()) - return false; - bool result = false; - sender_->Send(new AutomationMsg_SetBookmarkTitle(handle_, - id, title, - &result)); - return result; -} - -bool BrowserProxy::SetBookmarkURL(int64 id, const GURL& url) { - if (!is_valid()) - return false; - bool result = false; - sender_->Send(new AutomationMsg_SetBookmarkURL(handle_, - id, url, - &result)); - return result; -} - -bool BrowserProxy::RemoveBookmark(int64 id) { - if (!is_valid()) - return false; - bool result = false; - sender_->Send(new AutomationMsg_RemoveBookmark(handle_, - id, - &result)); - return result; -} - bool BrowserProxy::TerminateSession() { if (!is_valid()) return false; diff --git a/chrome/test/automation/browser_proxy.h b/chrome/test/automation/browser_proxy.h index d20792a..44e0cd3 100644 --- a/chrome/test/automation/browser_proxy.h +++ b/chrome/test/automation/browser_proxy.h @@ -122,35 +122,6 @@ class BrowserProxy : public AutomationResourceProxy { // executed, false otherwise. bool RunCommand(int browser_command) const WARN_UNUSED_RESULT; - // Returns whether the Bookmark bar is visible and whether we are animating - // it into position. Also returns whether it is currently detached from the - // location bar, as in the NTP. - // Returns false on failure. - bool GetBookmarkBarVisibility(bool* is_visible, - bool* is_animating, - bool* is_detached) WARN_UNUSED_RESULT; - - // Get the bookmarks as a JSON string and put it in |json_string|. - // Return true on success. - bool GetBookmarksAsJSON(std::string* json_string) WARN_UNUSED_RESULT; - - // Wait for the bookmarks to load. Called implicitly by GetBookmarksAsJSON(). - bool WaitForBookmarkModelToLoad() WARN_UNUSED_RESULT; - - // Editing of the bookmark model. Bookmarks are referenced by id. - // Bookmark or group (folder) creation: - bool AddBookmarkGroup(int64 parent_id, int index, - std::wstring& title) WARN_UNUSED_RESULT; - bool AddBookmarkURL(int64 parent_id, int index, - std::wstring& title, const GURL& url) WARN_UNUSED_RESULT; - // Bookmark editing: - bool ReparentBookmark(int64 id, int64 new_parent_id, - int index) WARN_UNUSED_RESULT; - bool SetBookmarkTitle(int64 id, const std::wstring& title) WARN_UNUSED_RESULT; - bool SetBookmarkURL(int64 id, const GURL& url) WARN_UNUSED_RESULT; - // Finally, bookmark deletion: - bool RemoveBookmark(int64 id) WARN_UNUSED_RESULT; - // Simulates a termination the browser session (as if the user logged off the // mahine). bool TerminateSession() WARN_UNUSED_RESULT; diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py index a2e081b..1d7b46f 100755 --- a/chrome/test/pyautolib/pyauto.py +++ b/chrome/test/pyautolib/pyauto.py @@ -1550,6 +1550,299 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): raise JSONInterfaceError('Could not resolve browser proxy.') return bookmark_model.BookmarkModel(bookmarks_as_json) + def _GetBookmarksAsJSON(self, windex=0): + """Get bookmarks as a JSON dictionary; used by GetBookmarkModel().""" + cmd_dict = { + 'command': 'GetBookmarksAsJSON', + 'windex': windex, + } + self.WaitForBookmarkModelToLoad(windex) + return self._GetResultFromJSONRequest(cmd_dict, + windex=None)['bookmarks_as_json'] + + def WaitForBookmarkModelToLoad(self, windex=0): + """Gets the status of the bookmark bar as a dictionary. + + Args: + windex: Integer index of the browser window to use; defaults to the first + window. + + Raises: + pyauto_errors.JSONInterfaceError if the automation call returns an error. + """ + cmd_dict = { + 'command': 'WaitForBookmarkModelToLoad', + 'windex': windex, + } + return self._GetResultFromJSONRequest(cmd_dict, windex=None) + + def GetBookmarkBarStatus(self, windex=0): + """Gets the status of the bookmark bar as a dictionary. + + Args: + windex: Integer index of the browser window to use; defaults to the first + window. + + Returns: + A dictionary. + Example: + { u'visible': True, + u'animating': False, + u'detached': False, } + + Raises: + pyauto_errors.JSONInterfaceError if the automation call returns an error. + """ + cmd_dict = { + 'command': 'GetBookmarkBarStatus', + 'windex': windex, + } + return self._GetResultFromJSONRequest(cmd_dict, windex=None) + + def GetBookmarkBarStatus(self, windex=0): + """Gets the status of the bookmark bar as a dictionary. + + Args: + windex: Integer index of the browser window to use; defaults to the first + window. + + Returns: + A dictionary. + Example: + { u'visible': True, + u'animating': False, + u'detached': False, } + + Raises: + pyauto_errors.JSONInterfaceError if the automation call returns an error. + """ + cmd_dict = { + 'command': 'GetBookmarkBarStatus', + 'windex': windex, + } + return self._GetResultFromJSONRequest(cmd_dict, windex=None) + + def GetBookmarkBarStatus(self, windex=0): + """Gets the status of the bookmark bar as a dictionary. + + Args: + windex: Integer index of the browser window to use; defaults to the first + window. + + Returns: + A dictionary. + Example: + { u'visible': True, + u'animating': False, + u'detached': False, } + + Raises: + pyauto_errors.JSONInterfaceError if the automation call returns an error. + """ + cmd_dict = { + 'command': 'GetBookmarkBarStatus', + 'windex': windex, + } + return self._GetResultFromJSONRequest(cmd_dict, windex=None) + + def GetBookmarkBarVisibility(self, windex=0): + """Returns the visibility of the bookmark bar. + + Args: + windex: Integer index of the browser window to use; defaults to the first + window. + + Returns: + True if the bookmark bar is visible, false otherwise. + + Raises: + pyauto_errors.JSONInterfaceError if the automation call returns an error. + """ + return self.GetBookmarkBarStatus(windex)['visible'] + + def IsBookmarkBarDetached(self, windex=0): + """Returns whether the bookmark bar is detached. + + Args: + windex: Integer index of the browser window to use; defaults to the first + window. + + Returns: + True if the bookmark bar is detached, false otherwise. + + Raises: + pyauto_errors.JSONInterfaceError if the automation call returns an error. + """ + return self.GetBookmarkBarStatus(windex)['detached'] + + def WaitForBookmarkBarVisibilityChange(self, wait_for_open, windex=0): + """Waits until the bookmark bar is either visible or not visible. + + Args: + wait_for_open: If True, wait until bookmark bar is visible; otherwise wait + until bookmark bar is not visible. + windex: Integer index of the browser window to use; defaults to the first + window. + + Raises: + pyauto_errors.JSONInterfaceError if the automation call returns an error. + """ + def IsChanged(wait_for_open, windex): + status = self.GetBookmarkBarStatus(windex) + return status['visible'] == wait_for_open and not status['animating'] + return self.WaitUntil(lambda: IsChanged(wait_for_open, windex)) + + def AddBookmarkGroup(self, parent_id, index, title, windex=0): + """Adds a bookmark folder. + + Args: + parent_id: The parent bookmark folder. + index: The location in the parent's list to insert this bookmark folder. + title: The name of the bookmark folder. + windex: Integer index of the browser window to use; defaults to the first + window. + + Returns: + True if the bookmark bar is detached, false otherwise. + + Raises: + pyauto_errors.JSONInterfaceError if the automation call returns an error. + """ + if isinstance(parent_id, basestring): + parent_id = int(parent_id) + cmd_dict = { + 'command': 'AddBookmark', + 'parent_id': parent_id, + 'index': index, + 'title': title, + 'is_folder': True, + 'windex': windex, + } + self.WaitForBookmarkModelToLoad(windex) + self._GetResultFromJSONRequest(cmd_dict, windex=None) + + def AddBookmarkURL(self, parent_id, index, title, url, windex=0): + """Add a bookmark URL. + + Args: + parent_id: The parent bookmark folder. + index: The location in the parent's list to insert this bookmark. + title: The name of the bookmark. + url: The url of the bookmark. + windex: Integer index of the browser window to use; defaults to the first + window. + + Raises: + pyauto_errors.JSONInterfaceError if the automation call returns an error. + """ + if isinstance(parent_id, basestring): + parent_id = int(parent_id) + cmd_dict = { + 'command': 'AddBookmark', + 'parent_id': parent_id, + 'index': index, + 'title': title, + 'url': url, + 'is_folder': False, + 'windex': windex, + } + self.WaitForBookmarkModelToLoad(windex) + self._GetResultFromJSONRequest(cmd_dict, windex=None) + + def ReparentBookmark(self, id, new_parent_id, index, windex=0): + """Move a bookmark. + + Args: + id: The bookmark to move. + new_parent_id: The new parent bookmark folder. + index: The location in the parent's list to insert this bookmark. + windex: Integer index of the browser window to use; defaults to the first + window. + + Raises: + pyauto_errors.JSONInterfaceError if the automation call returns an error. + """ + if isinstance(id, basestring): + id = int(id) + if isinstance(new_parent_id, basestring): + new_parent_id = int(new_parent_id) + cmd_dict = { + 'command': 'ReparentBookmark', + 'id': id, + 'new_parent_id': new_parent_id, + 'index': index, + 'windex': windex, + } + self.WaitForBookmarkModelToLoad(windex) + self._GetResultFromJSONRequest(cmd_dict, windex=None) + + def SetBookmarkTitle(self, id, title, windex=0): + """Change the title of a bookmark. + + Args: + id: The bookmark to rename. + title: The new title for the bookmark. + windex: Integer index of the browser window to use; defaults to the first + window. + + Raises: + pyauto_errors.JSONInterfaceError if the automation call returns an error. + """ + if isinstance(id, basestring): + id = int(id) + cmd_dict = { + 'command': 'SetBookmarkTitle', + 'id': id, + 'title': title, + 'windex': windex, + } + self.WaitForBookmarkModelToLoad(windex) + self._GetResultFromJSONRequest(cmd_dict, windex=None) + + def SetBookmarkURL(self, id, url, windex=0): + """Change the URL of a bookmark. + + Args: + id: The bookmark to change. + url: The new url for the bookmark. + windex: Integer index of the browser window to use; defaults to the first + window. + + Raises: + pyauto_errors.JSONInterfaceError if the automation call returns an error. + """ + if isinstance(id, basestring): + id = int(id) + cmd_dict = { + 'command': 'SetBookmarkURL', + 'id': id, + 'url': url, + 'windex': windex, + } + self.WaitForBookmarkModelToLoad(windex) + self._GetResultFromJSONRequest(cmd_dict, windex=None) + + def RemoveBookmark(self, id, windex=0): + """Remove a bookmark. + + Args: + id: The bookmark to remove. + windex: Integer index of the browser window to use; defaults to the first + window. + + Raises: + pyauto_errors.JSONInterfaceError if the automation call returns an error. + """ + if isinstance(id, basestring): + id = int(id) + cmd_dict = { + 'command': 'RemoveBookmark', + 'id': id, + 'windex': windex, + } + self.WaitForBookmarkModelToLoad(windex) + self._GetResultFromJSONRequest(cmd_dict, windex=None) + def GetDownloadsInfo(self, windex=0): """Return info about downloads. diff --git a/chrome/test/pyautolib/pyautolib.cc b/chrome/test/pyautolib/pyautolib.cc index d053bdc..a4977f5 100644 --- a/chrome/test/pyautolib/pyautolib.cc +++ b/chrome/test/pyautolib/pyautolib.cc @@ -19,12 +19,6 @@ #include "chrome/test/pyautolib/pyautolib.h" #include "googleurl/src/gurl.h" -static int64 StringToId(const std::wstring& str) { - int64 id; - base::StringToInt64(WideToUTF8(str), &id); - return id; -} - // PyUITestSuiteBase PyUITestSuiteBase::PyUITestSuiteBase(int argc, char** argv) : UITestSuite(argc, argv) { @@ -102,136 +96,6 @@ void PyUITestBase::SetLaunchSwitches() { launch_arguments_.AppendSwitchASCII(switches::kHomePage, homepage_); } -bool PyUITestBase::GetBookmarkBarState(bool* visible, - bool* detached, - int window_index) { - scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); - EXPECT_TRUE(browser_proxy.get()); - if (!browser_proxy.get()) - return false; - - // We have no use for animating in this context. - bool animating; - EXPECT_TRUE(browser_proxy->GetBookmarkBarVisibility(visible, - &animating, - detached)); - return true; -} - -bool PyUITestBase::GetBookmarkBarVisibility() { - // We have no use for detached in this context. - bool visible, detached; - if (!GetBookmarkBarState(&visible, &detached)) - return false; - return visible; -} - -bool PyUITestBase::IsBookmarkBarDetached() { - // We have no use for visible in this context. - bool visible, detached; - if (!GetBookmarkBarState(&visible, &detached)) - return false; - return detached; -} - -bool PyUITestBase::WaitForBookmarkBarVisibilityChange(bool wait_for_open, - int window_index) { - scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); - EXPECT_TRUE(browser_proxy.get()); - if (!browser_proxy.get()) - return false; - - // This has a 20sec timeout. If that's not enough we have serious problems. - bool completed = UITestBase::WaitForBookmarkBarVisibilityChange( - browser_proxy.get(), - wait_for_open); - EXPECT_TRUE(completed); - return completed; -} - -std::string PyUITestBase::_GetBookmarksAsJSON(int window_index) { - scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); - EXPECT_TRUE(browser_proxy.get()); - if (!browser_proxy.get()) - return std::string(); - - std::string s; - EXPECT_TRUE(browser_proxy->GetBookmarksAsJSON(&s)); - return s; -} - -bool PyUITestBase::AddBookmarkGroup(std::wstring& parent_id, - int index, - std::wstring& title, - int window_index) { - scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); - EXPECT_TRUE(browser_proxy.get()); - if (!browser_proxy.get()) - return false; - - return browser_proxy->AddBookmarkGroup(StringToId(parent_id), index, title); -} - -bool PyUITestBase::AddBookmarkURL(std::wstring& parent_id, - int index, - std::wstring& title, - std::wstring& url, - int window_index) { - scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); - EXPECT_TRUE(browser_proxy.get()); - if (!browser_proxy.get()) - return false; - - return browser_proxy->AddBookmarkURL(StringToId(parent_id), - index, title, - GURL(WideToUTF8(url))); -} - -bool PyUITestBase::ReparentBookmark(std::wstring& id, - std::wstring& new_parent_id, - int index, - int window_index) { - scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); - EXPECT_TRUE(browser_proxy.get()); - if (!browser_proxy.get()) - return false; - - return browser_proxy->ReparentBookmark(StringToId(id), - StringToId(new_parent_id), - index); -} - -bool PyUITestBase::SetBookmarkTitle(std::wstring& id, - std::wstring& title, - int window_index) { - scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); - EXPECT_TRUE(browser_proxy.get()); - if (!browser_proxy.get()) - return false; - - return browser_proxy->SetBookmarkTitle(StringToId(id), title); -} - -bool PyUITestBase::SetBookmarkURL(std::wstring& id, - std::wstring& url, - int window_index) { - scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); - EXPECT_TRUE(browser_proxy.get()); - if (!browser_proxy.get()) - return false; - - return browser_proxy->SetBookmarkURL(StringToId(id), GURL(WideToUTF8(url))); -} - -bool PyUITestBase::RemoveBookmark(std::wstring& id, int window_index) { - scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); - EXPECT_TRUE(browser_proxy.get()); - if (!browser_proxy.get()) - return false; - - return browser_proxy->RemoveBookmark(StringToId(id)); -} - AutomationProxy* PyUITestBase::automation() const { AutomationProxy* automation_proxy = UITestBase::automation(); if (!automation_proxy) { @@ -240,7 +104,6 @@ AutomationProxy* PyUITestBase::automation() const { return automation_proxy; } - scoped_refptr<BrowserProxy> PyUITestBase::GetBrowserWindow(int window_index) { return automation()->GetBrowserWindow(window_index); } diff --git a/chrome/test/pyautolib/pyautolib.h b/chrome/test/pyautolib/pyautolib.h index b18236e..cd7cf5d 100644 --- a/chrome/test/pyautolib/pyautolib.h +++ b/chrome/test/pyautolib/pyautolib.h @@ -71,47 +71,6 @@ class PyUITestBase : public UITestBase { // AutomationProxy methods - // Returns bookmark bar visibility state. - bool GetBookmarkBarVisibility(); - - // Returns true if the bookmark bar is visible in the detached state. - bool IsBookmarkBarDetached(); - - // Returns bookmark bar animation state. Warning: timing issues may - // change this return value unexpectedly. - bool IsBookmarkBarAnimating(); - - // Wait for the bookmark bar animation to complete. - // If |wait_for_open| is true, wait for it to open. - // If |wait_for_open| is false, wait for it to close. - bool WaitForBookmarkBarVisibilityChange(bool wait_for_open, - int window_index = 0); - - // Get the bookmarks as a JSON string. Internal method. - std::string _GetBookmarksAsJSON(int window_index = 0); - - // Editing of the bookmark model. Bookmarks are referenced by id. - // The id is a std::wstring, not an int64, for convenience, since - // the python side gets IDs converted from a JSON representation - // (which "extracts" into a string, not an int). Since IDs are - // grabbed from the current model (and not generated), a conversion - // is unnecessary. URLs are strings and not GURLs for a similar reason. - // Bookmark or group (folder) creation: - bool AddBookmarkGroup(std::wstring& parent_id, int index, - std::wstring& title, int window_index = 0); - bool AddBookmarkURL(std::wstring& parent_id, int index, - std::wstring& title, std::wstring& url, - int window_index = 0); - // Bookmark editing: - bool ReparentBookmark(std::wstring& id, std::wstring& new_parent_id, - int index, int window_index = 0); - bool SetBookmarkTitle(std::wstring& id, std::wstring& title, - int window_index = 0); - bool SetBookmarkURL(std::wstring& id, std::wstring& url, - int window_index = 0); - // Finally, bookmark deletion: - bool RemoveBookmark(std::wstring& id, int window_index = 0); - // Get a handle to browser window at the given index, or NULL on failure. scoped_refptr<BrowserProxy> GetBrowserWindow(int window_index); @@ -164,9 +123,6 @@ class PyUITestBase : public UITestBase { const base::TimeDelta& timeout, std::string* response); - // Gets the current state of the bookmark bar. Returns false if it failed. - bool GetBookmarkBarState(bool* visible, bool* detached, int window_index = 0); - // Enables PostTask to main thread. // Should be shared across multiple instances of PyUITestBase so that this // class is re-entrant and multiple instances can be created. diff --git a/chrome/test/pyautolib/pyautolib.i b/chrome/test/pyautolib/pyautolib.i index aedc5b67..8826a2b 100644 --- a/chrome/test/pyautolib/pyautolib.i +++ b/chrome/test/pyautolib/pyautolib.i @@ -175,59 +175,6 @@ class PyUITestBase { %feature("docstring", "Get the path to profile directory.") user_data_dir; FilePath user_data_dir() const; - %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", "Determine if the bookmark bar is detached. " - "This usually is only true on the NTP.") IsBookmarkBarDetached; - bool IsBookmarkBarDetached(); - - %feature("docstring", "Wait for the bookmark bar animation to complete. " - "|wait_for_open| specifies which kind of change we wait for.") - WaitForBookmarkBarVisibilityChange; - bool WaitForBookmarkBarVisibilityChange(bool wait_for_open, - int window_index=0); - - %feature("docstring", "Get the bookmarks as a JSON string. Internal method.") - _GetBookmarksAsJSON; - std::string _GetBookmarksAsJSON(int window_index=0); - - %feature("docstring", "Add a bookmark folder with the given index in the " - " parent. |title| is the title/name of the folder.") - AddBookmarkGroup; - bool AddBookmarkGroup(std::wstring parent_id, - int index, std::wstring title, - int window_index=0); - - %feature("docstring", "Add a bookmark with the given title and URL.") - AddBookmarkURL; - bool AddBookmarkURL(std::wstring parent_id, - int index, - std::wstring title, - const std::wstring url, - int window_index=0); - - %feature("docstring", "Move a bookmark to a new parent.") ReparentBookmark; - bool ReparentBookmark(std::wstring id, - std::wstring new_parent_id, - int index, - int window_index=0); - - %feature("docstring", "Set the title of a bookmark.") SetBookmarkTitle; - bool SetBookmarkTitle(std::wstring id, - std::wstring title, - int window_index=0); - - %feature("docstring", "Set the URL of a bookmark.") SetBookmarkURL; - bool SetBookmarkURL(std::wstring id, - const std::wstring url, - int window_index=0); - - %feature("docstring", "Remove (delete) a bookmark.") RemoveBookmark; - bool RemoveBookmark(std::wstring id, int window_index=0); - // Meta-method %feature("docstring", "Send a sync JSON request to Chrome. " "Returns a JSON dict as a response. " diff --git a/chrome/test/reliability/automated_ui_test_base.cc b/chrome/test/reliability/automated_ui_test_base.cc index 3679435..ec8a704 100644 --- a/chrome/test/reliability/automated_ui_test_base.cc +++ b/chrome/test/reliability/automated_ui_test_base.cc @@ -317,27 +317,6 @@ bool AutomatedUITestBase::SelectPreviousTab() { return RunCommand(IDC_SELECT_PREVIOUS_TAB); } -bool AutomatedUITestBase::ShowBookmarkBar() { - bool is_visible; - bool is_animating; - bool is_detached; - if (!active_browser()->GetBookmarkBarVisibility(&is_visible, - &is_animating, - &is_detached)) { - return false; - } - - if (is_visible) { - // If the bar is visible, then issuing the command again will toggle it. - return true; - } - - if (!RunCommandAsync(IDC_SHOW_BOOKMARK_BAR)) - return false; - - return WaitForBookmarkBarVisibilityChange(active_browser(), true); -} - bool AutomatedUITestBase::ShowDownloads() { return RunCommand(IDC_SHOW_DOWNLOADS); } diff --git a/chrome/test/reliability/automated_ui_test_base.h b/chrome/test/reliability/automated_ui_test_base.h index 36f170e..8fbf138 100644 --- a/chrome/test/reliability/automated_ui_test_base.h +++ b/chrome/test/reliability/automated_ui_test_base.h @@ -107,10 +107,6 @@ class AutomatedUITestBase : public UITest { // Returns true on success. bool SelectPreviousTab(); - // Displays the bookmark bar. - // Returns true on success. - bool ShowBookmarkBar(); - // Opens the Downloads page in the current active browser window. // Returns true on success. bool ShowDownloads(); diff --git a/chrome/test/reliability/automated_ui_tests.cc b/chrome/test/reliability/automated_ui_tests.cc index 108d44a..b214c68 100644 --- a/chrome/test/reliability/automated_ui_tests.cc +++ b/chrome/test/reliability/automated_ui_tests.cc @@ -448,8 +448,6 @@ bool AutomatedUITest::DoAction(const std::string& action) { did_complete_action = SelectNextTab(); } else if (LowerCaseEqualsASCII(action, "selectprevtab")) { did_complete_action = SelectPreviousTab(); - } else if (LowerCaseEqualsASCII(action, "showbookmarks")) { - did_complete_action = ShowBookmarkBar(); } else if (LowerCaseEqualsASCII(action, "setup")) { AutomatedUITestBase::SetUp(); did_complete_action = true; diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index 2128b9d..de01ff5 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -313,27 +313,6 @@ void UITestBase::NavigateToURLBlockUntilNavigationsComplete( url, number_of_navigations)) << url.spec(); } -bool UITestBase::WaitForBookmarkBarVisibilityChange(BrowserProxy* browser, - bool wait_for_open) { - const int kCycles = 10; - const TimeDelta kDelay = TestTimeouts::action_timeout() / kCycles; - for (int i = 0; i < kCycles; i++) { - bool visible = false; - bool animating = true; - bool detached; - if (!browser->GetBookmarkBarVisibility(&visible, &animating, &detached)) - return false; // Some error. - if (visible == wait_for_open && !animating) - return true; // Bookmark bar visibility change complete. - - // Give it a chance to catch up. - base::PlatformThread::Sleep(kDelay); - } - - ADD_FAILURE() << "Timeout reached in WaitForBookmarkBarVisibilityChange"; - return false; -} - GURL UITestBase::GetActiveTabURL(int window_index) { scoped_refptr<TabProxy> tab_proxy(GetActiveTab(window_index)); EXPECT_TRUE(tab_proxy.get()); diff --git a/chrome/test/ui/ui_test.h b/chrome/test/ui/ui_test.h index a8d252e..23d4cac 100644 --- a/chrome/test/ui/ui_test.h +++ b/chrome/test/ui/ui_test.h @@ -141,12 +141,6 @@ class UITestBase { // assert that the tab count is valid at the end of the wait. void WaitUntilTabCount(int tab_count); - // Waits until the Bookmark bar has stopped animating and become fully visible - // (if |wait_for_open| is true) or fully hidden (if |wait_for_open| is false). - // This function can time out (in which case it returns false). - bool WaitForBookmarkBarVisibilityChange(BrowserProxy* browser, - bool wait_for_open); - // Closes the specified browser. Returns true if the browser was closed. // This call is blocking. |application_closed| is set to true if this was // the last browser window (and therefore as a result of it closing the |