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

Unified Diff: chrome/test/automation/tab_proxy.cc

Issue 6507015: Implement the target locator commands for ChromeDriver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address Pawel's concerns Created 9 years, 10 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
Index: chrome/test/automation/tab_proxy.cc
diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc
index e04c039ba13fb10c8c826665b785068e11e3aa0c..20444a00ae01337e350e96724225cbe37f72dffb 100644
--- a/chrome/test/automation/tab_proxy.cc
+++ b/chrome/test/automation/tab_proxy.cc
@@ -13,6 +13,7 @@
#include "chrome/common/automation_messages.h"
#include "chrome/common/json_value_serializer.h"
#include "chrome/test/automation/automation_proxy.h"
+#include "chrome/test/automation/browser_proxy.h"
#include "googleurl/src/gurl.h"
TabProxy::TabProxy(AutomationMessageSender* sender,
@@ -21,6 +22,28 @@ TabProxy::TabProxy(AutomationMessageSender* sender,
: AutomationResourceProxy(tracker, sender, handle) {
}
+scoped_refptr<BrowserProxy> TabProxy::GetParentBrowser() const {
+ if (!is_valid())
+ return NULL;
+
+ int browser_handle = 0;
+ sender_->Send(
+ new AutomationMsg_GetParentBrowserOfTab(handle_, &browser_handle));
+ if (!browser_handle)
+ return NULL;
+
+ BrowserProxy* browser = static_cast<BrowserProxy*>(
+ tracker_->GetResource(browser_handle));
+ if (!browser) {
+ browser = new BrowserProxy(sender_, tracker_, browser_handle);
+ browser->AddRef();
+ }
+
+ // Since there is no scoped_refptr::attach.
+ scoped_refptr<BrowserProxy> result;
+ result.swap(&browser);
+ return result;
+}
bool TabProxy::GetTabTitle(std::wstring* title) const {
if (!is_valid())

Powered by Google App Engine
This is Rietveld 408576698