Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: chrome/test/pyautolib/pyautolib.cc

Issue 10828245: Final set of conversions of automation calls to the JSON interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/pyautolib/pyautolib.h ('k') | chrome/test/pyautolib/pyautolib.i » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/pyautolib/pyautolib.cc
diff --git a/chrome/test/pyautolib/pyautolib.cc b/chrome/test/pyautolib/pyautolib.cc
index d053bdc1193787f04a5d30355210c2a1f9a83a66..a4977f52a2a546932edd0b938de14477502a28bc 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);
}
« no previous file with comments | « chrome/test/pyautolib/pyautolib.h ('k') | chrome/test/pyautolib/pyautolib.i » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698