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

Side by Side Diff: chrome/test/automation/window_proxy.cc

Issue 10388175: Remove all the unnused automation IPCs. These were used by UI tests that have been converted to bro… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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/window_proxy.h ('k') | chrome/test/ui/ui_test.h » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/window_proxy.h" 5 #include "chrome/test/automation/window_proxy.h"
6 6
7 #include <vector> 7 #include <vector>
8 #include <algorithm> 8 #include <algorithm>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "chrome/common/automation_constants.h" 11 #include "chrome/common/automation_constants.h"
12 #include "chrome/common/automation_messages.h" 12 #include "chrome/common/automation_messages.h"
13 #include "chrome/test/automation/automation_proxy.h" 13 #include "chrome/test/automation/automation_proxy.h"
14 #include "chrome/test/automation/browser_proxy.h" 14 #include "chrome/test/automation/browser_proxy.h"
15 #include "chrome/test/automation/tab_proxy.h" 15 #include "chrome/test/automation/tab_proxy.h"
16 #include "googleurl/src/gurl.h" 16 #include "googleurl/src/gurl.h"
17 #include "ui/gfx/rect.h" 17 #include "ui/gfx/rect.h"
18 18
19 bool WindowProxy::SimulateOSClick(const gfx::Point& click, int flags) {
20 if (!is_valid()) return false;
21
22 return sender_->Send(new AutomationMsg_WindowClick(handle_, click, flags));
23 }
24
25 bool WindowProxy::SimulateOSMouseMove(const gfx::Point& location) { 19 bool WindowProxy::SimulateOSMouseMove(const gfx::Point& location) {
26 if (!is_valid()) return false; 20 if (!is_valid()) return false;
27 21
28 return sender_->Send( 22 return sender_->Send(
29 new AutomationMsg_WindowMouseMove(handle_, location)); 23 new AutomationMsg_WindowMouseMove(handle_, location));
30 } 24 }
31 25
32 bool WindowProxy::GetWindowTitle(string16* text) {
33 if (!is_valid()) return false;
34
35 if (!text) {
36 NOTREACHED();
37 return false;
38 }
39
40 return sender_->Send(new AutomationMsg_WindowTitle(handle_, text));
41 }
42
43 bool WindowProxy::SimulateOSKeyPress(ui::KeyboardCode key, int flags) { 26 bool WindowProxy::SimulateOSKeyPress(ui::KeyboardCode key, int flags) {
44 if (!is_valid()) return false; 27 if (!is_valid()) return false;
45 28
46 return sender_->Send( 29 return sender_->Send(
47 new AutomationMsg_WindowKeyPress(handle_, key, flags)); 30 new AutomationMsg_WindowKeyPress(handle_, key, flags));
48 } 31 }
49 32
50 bool WindowProxy::SetVisible(bool visible) {
51 if (!is_valid()) return false;
52
53 bool result = false;
54
55 sender_->Send(new AutomationMsg_SetWindowVisible(handle_, visible, &result));
56 return result;
57 }
58
59 bool WindowProxy::IsActive(bool* active) {
60 if (!is_valid()) return false;
61
62 bool result = false;
63
64 sender_->Send(new AutomationMsg_IsWindowActive(handle_, &result, active));
65 return result;
66 }
67
68 bool WindowProxy::Activate() {
69 if (!is_valid()) return false;
70
71 return sender_->Send(new AutomationMsg_ActivateWindow(handle_));
72 }
73
74 bool WindowProxy::GetViewBounds(int view_id, gfx::Rect* bounds, 33 bool WindowProxy::GetViewBounds(int view_id, gfx::Rect* bounds,
75 bool screen_coordinates) { 34 bool screen_coordinates) {
76 if (!is_valid()) 35 if (!is_valid())
77 return false; 36 return false;
78 37
79 if (!bounds) { 38 if (!bounds) {
80 NOTREACHED(); 39 NOTREACHED();
81 return false; 40 return false;
82 } 41 }
83 42
84 bool result = false; 43 bool result = false;
85 44
86 if (!sender_->Send(new AutomationMsg_WindowViewBounds( 45 if (!sender_->Send(new AutomationMsg_WindowViewBounds(
87 handle_, view_id, screen_coordinates, &result, bounds))) { 46 handle_, view_id, screen_coordinates, &result, bounds))) {
88 return false; 47 return false;
89 } 48 }
90 49
91 return result; 50 return result;
92 } 51 }
93 52
94 bool WindowProxy::GetBounds(gfx::Rect* bounds) {
95 if (!is_valid())
96 return false;
97 bool result = false;
98 sender_->Send(new AutomationMsg_GetWindowBounds(handle_, bounds, &result));
99 return result;
100 }
101
102 bool WindowProxy::SetBounds(const gfx::Rect& bounds) { 53 bool WindowProxy::SetBounds(const gfx::Rect& bounds) {
103 if (!is_valid()) 54 if (!is_valid())
104 return false; 55 return false;
105 bool result = false; 56 bool result = false;
106 sender_->Send(new AutomationMsg_SetWindowBounds(handle_, bounds, &result)); 57 sender_->Send(new AutomationMsg_SetWindowBounds(handle_, bounds, &result));
107 return result; 58 return result;
108 } 59 }
109
110 scoped_refptr<BrowserProxy> WindowProxy::GetBrowser() {
111 return GetBrowserWithTimeout(base::kNoTimeout, NULL);
112 }
113
114 scoped_refptr<BrowserProxy> WindowProxy::GetBrowserWithTimeout(
115 uint32 timeout_ms, bool* is_timeout) {
116 if (!is_valid())
117 return NULL;
118
119 bool handle_ok = false;
120 int browser_handle = 0;
121
122 sender_->Send(new AutomationMsg_BrowserForWindow(handle_, &handle_ok,
123 &browser_handle));
124 if (!handle_ok)
125 return NULL;
126
127 BrowserProxy* browser =
128 static_cast<BrowserProxy*>(tracker_->GetResource(browser_handle));
129 if (!browser) {
130 browser = new BrowserProxy(sender_, tracker_, browser_handle);
131 browser->AddRef();
132 }
133
134 // Since there is no scoped_refptr::attach.
135 scoped_refptr<BrowserProxy> result;
136 result.swap(&browser);
137 return result;
138 }
139
140 bool WindowProxy::IsMaximized(bool* maximized) {
141 if (!is_valid())
142 return false;
143
144 bool result = false;
145
146 sender_->Send(new AutomationMsg_IsWindowMaximized(handle_, maximized,
147 &result));
148 return result;
149 }
OLDNEW
« no previous file with comments | « chrome/test/automation/window_proxy.h ('k') | chrome/test/ui/ui_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698