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

Side by Side 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: ... 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/automation/tab_proxy.h ('k') | chrome/test/webdriver/WEBDRIVER_TESTS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/test/automation/tab_proxy.h" 5 #include "chrome/test/automation/tab_proxy.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
11 #include "base/threading/platform_thread.h" 11 #include "base/threading/platform_thread.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/common/automation_messages.h" 13 #include "chrome/common/automation_messages.h"
14 #include "chrome/common/json_value_serializer.h" 14 #include "chrome/common/json_value_serializer.h"
15 #include "chrome/test/automation/automation_proxy.h" 15 #include "chrome/test/automation/automation_proxy.h"
16 #include "chrome/test/automation/browser_proxy.h"
16 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
17 18
18 TabProxy::TabProxy(AutomationMessageSender* sender, 19 TabProxy::TabProxy(AutomationMessageSender* sender,
19 AutomationHandleTracker* tracker, 20 AutomationHandleTracker* tracker,
20 int handle) 21 int handle)
21 : AutomationResourceProxy(tracker, sender, handle) { 22 : AutomationResourceProxy(tracker, sender, handle) {
22 } 23 }
23 24
25 scoped_refptr<BrowserProxy> TabProxy::GetParentBrowser() const {
26 if (!is_valid())
27 return NULL;
28
29 int browser_handle = 0;
30 bool success = false;
31 sender_->Send(new AutomationMsg_GetParentBrowserOfTab(
32 handle_, &browser_handle, &success));
33 if (!success)
34 return NULL;
35
36 BrowserProxy* browser = static_cast<BrowserProxy*>(
37 tracker_->GetResource(browser_handle));
38 if (!browser) {
39 browser = new BrowserProxy(sender_, tracker_, browser_handle);
40 browser->AddRef();
41 }
42
43 // Since there is no scoped_refptr::attach.
44 scoped_refptr<BrowserProxy> result;
45 result.swap(&browser);
46 return result;
47 }
24 48
25 bool TabProxy::GetTabTitle(std::wstring* title) const { 49 bool TabProxy::GetTabTitle(std::wstring* title) const {
26 if (!is_valid()) 50 if (!is_valid())
27 return false; 51 return false;
28 52
29 if (!title) { 53 if (!title) {
30 NOTREACHED(); 54 NOTREACHED();
31 return false; 55 return false;
32 } 56 }
33 57
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 json)); 853 json));
830 } 854 }
831 855
832 void TabProxy::FirstObjectAdded() { 856 void TabProxy::FirstObjectAdded() {
833 AddRef(); 857 AddRef();
834 } 858 }
835 859
836 void TabProxy::LastObjectRemoved() { 860 void TabProxy::LastObjectRemoved() {
837 Release(); 861 Release();
838 } 862 }
OLDNEW
« no previous file with comments | « chrome/test/automation/tab_proxy.h ('k') | chrome/test/webdriver/WEBDRIVER_TESTS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698