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

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

Issue 27060: Make basic bits of chrome/test/automation build on Linux. (Closed)
Patch Set: use base::kNoTimeout Created 11 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
« no previous file with comments | « chrome/test/automation/browser_proxy.h ('k') | chrome/test/automation/tab_proxy.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/browser_proxy.h" 5 #include "chrome/test/automation/browser_proxy.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 #include "chrome/test/automation/autocomplete_edit_proxy.h" 11 #include "chrome/test/automation/autocomplete_edit_proxy.h"
12 #include "chrome/test/automation/automation_constants.h" 12 #include "chrome/test/automation/automation_constants.h"
13 #include "chrome/test/automation/automation_messages.h" 13 #include "chrome/test/automation/automation_messages.h"
14 #include "chrome/test/automation/automation_proxy.h" 14 #include "chrome/test/automation/automation_proxy.h"
15 #include "chrome/test/automation/tab_proxy.h" 15 #include "chrome/test/automation/tab_proxy.h"
16 #include "chrome/test/automation/window_proxy.h" 16 #include "chrome/test/automation/window_proxy.h"
17 17
18 using base::TimeDelta; 18 using base::TimeDelta;
19 using base::TimeTicks; 19 using base::TimeTicks;
20 20
21 bool BrowserProxy::ActivateTab(int tab_index) { 21 bool BrowserProxy::ActivateTab(int tab_index) {
22 return ActivateTabWithTimeout(tab_index, INFINITE, NULL); 22 return ActivateTabWithTimeout(tab_index, base::kNoTimeout, NULL);
23 } 23 }
24 24
25 bool BrowserProxy::ActivateTabWithTimeout(int tab_index, uint32 timeout_ms, 25 bool BrowserProxy::ActivateTabWithTimeout(int tab_index, uint32 timeout_ms,
26 bool* is_timeout) { 26 bool* is_timeout) {
27 if (!is_valid()) 27 if (!is_valid())
28 return false; 28 return false;
29 29
30 int activate_tab_response = -1; 30 int activate_tab_response = -1;
31 31
32 sender_->SendWithTimeout(new AutomationMsg_ActivateTab( 32 sender_->SendWithTimeout(new AutomationMsg_ActivateTab(
33 0, handle_, tab_index, &activate_tab_response), timeout_ms, is_timeout); 33 0, handle_, tab_index, &activate_tab_response), timeout_ms, is_timeout);
34 34
35 if (activate_tab_response >= 0) 35 if (activate_tab_response >= 0)
36 return true; 36 return true;
37 37
38 return false; 38 return false;
39 } 39 }
40 40
41 bool BrowserProxy::BringToFront() { 41 bool BrowserProxy::BringToFront() {
42 return BringToFrontWithTimeout(INFINITE, NULL); 42 return BringToFrontWithTimeout(base::kNoTimeout, NULL);
43 } 43 }
44 44
45 bool BrowserProxy::BringToFrontWithTimeout(uint32 timeout_ms, 45 bool BrowserProxy::BringToFrontWithTimeout(uint32 timeout_ms,
46 bool* is_timeout) { 46 bool* is_timeout) {
47 if (!is_valid()) 47 if (!is_valid())
48 return false; 48 return false;
49 49
50 bool succeeded = false; 50 bool succeeded = false;
51 51
52 sender_->SendWithTimeout(new AutomationMsg_BringBrowserToFront( 52 sender_->SendWithTimeout(new AutomationMsg_BringBrowserToFront(
(...skipping 21 matching lines...) Expand all
74 return false; 74 return false;
75 75
76 int append_tab_response = -1; 76 int append_tab_response = -1;
77 77
78 sender_->Send(new AutomationMsg_AppendTab(0, handle_, tab_url, 78 sender_->Send(new AutomationMsg_AppendTab(0, handle_, tab_url,
79 &append_tab_response)); 79 &append_tab_response));
80 return append_tab_response >= 0; 80 return append_tab_response >= 0;
81 } 81 }
82 82
83 bool BrowserProxy::GetActiveTabIndex(int* active_tab_index) const { 83 bool BrowserProxy::GetActiveTabIndex(int* active_tab_index) const {
84 return GetActiveTabIndexWithTimeout(active_tab_index, INFINITE, NULL); 84 return GetActiveTabIndexWithTimeout(active_tab_index, base::kNoTimeout, NULL);
85 } 85 }
86 86
87 bool BrowserProxy::GetActiveTabIndexWithTimeout(int* active_tab_index, 87 bool BrowserProxy::GetActiveTabIndexWithTimeout(int* active_tab_index,
88 uint32 timeout_ms, 88 uint32 timeout_ms,
89 bool* is_timeout) const { 89 bool* is_timeout) const {
90 if (!is_valid()) 90 if (!is_valid())
91 return false; 91 return false;
92 92
93 if (!active_tab_index) { 93 if (!active_tab_index) {
94 NOTREACHED(); 94 NOTREACHED();
(...skipping 22 matching lines...) Expand all
117 int handle = 0; 117 int handle = 0;
118 118
119 sender_->Send(new AutomationMsg_Tab(0, handle_, tab_index, &handle)); 119 sender_->Send(new AutomationMsg_Tab(0, handle_, tab_index, &handle));
120 if (!handle) 120 if (!handle)
121 return NULL; 121 return NULL;
122 122
123 return new TabProxy(sender_, tracker_, handle); 123 return new TabProxy(sender_, tracker_, handle);
124 } 124 }
125 125
126 TabProxy* BrowserProxy::GetActiveTab() const { 126 TabProxy* BrowserProxy::GetActiveTab() const {
127 return GetActiveTabWithTimeout(INFINITE, NULL); 127 return GetActiveTabWithTimeout(base::kNoTimeout, NULL);
128 } 128 }
129 129
130 TabProxy* BrowserProxy::GetActiveTabWithTimeout(uint32 timeout_ms, 130 TabProxy* BrowserProxy::GetActiveTabWithTimeout(uint32 timeout_ms,
131 bool* is_timeout) const { 131 bool* is_timeout) const {
132 int active_tab_index; 132 int active_tab_index;
133 if (!GetActiveTabIndexWithTimeout(&active_tab_index, timeout_ms, is_timeout)) 133 if (!GetActiveTabIndexWithTimeout(&active_tab_index, timeout_ms, is_timeout))
134 return NULL; 134 return NULL;
135 return GetTab(active_tab_index); 135 return GetTab(active_tab_index);
136 } 136 }
137 137
138 bool BrowserProxy::GetTabCount(int* num_tabs) const { 138 bool BrowserProxy::GetTabCount(int* num_tabs) const {
139 return GetTabCountWithTimeout(num_tabs, INFINITE, NULL); 139 return GetTabCountWithTimeout(num_tabs, base::kNoTimeout, NULL);
140 } 140 }
141 141
142 bool BrowserProxy::GetTabCountWithTimeout(int* num_tabs, uint32 timeout_ms, 142 bool BrowserProxy::GetTabCountWithTimeout(int* num_tabs, uint32 timeout_ms,
143 bool* is_timeout) const { 143 bool* is_timeout) const {
144 if (!is_valid()) 144 if (!is_valid())
145 return false; 145 return false;
146 146
147 if (!num_tabs) { 147 if (!num_tabs) {
148 NOTREACHED(); 148 NOTREACHED();
149 return false; 149 return false;
(...skipping 18 matching lines...) Expand all
168 return false; 168 return false;
169 169
170 return sender_->Send( 170 return sender_->Send(
171 new AutomationMsg_ApplyAccelerator(0, handle_, id)); 171 new AutomationMsg_ApplyAccelerator(0, handle_, id));
172 } 172 }
173 173
174 bool BrowserProxy::SimulateDrag(const POINT& start, 174 bool BrowserProxy::SimulateDrag(const POINT& start,
175 const POINT& end, 175 const POINT& end,
176 int flags, 176 int flags,
177 bool press_escape_en_route) { 177 bool press_escape_en_route) {
178 return SimulateDragWithTimeout(start, end, flags, INFINITE, NULL, 178 return SimulateDragWithTimeout(start, end, flags, base::kNoTimeout, NULL,
179 press_escape_en_route); 179 press_escape_en_route);
180 } 180 }
181 181
182 bool BrowserProxy::SimulateDragWithTimeout(const POINT& start, 182 bool BrowserProxy::SimulateDragWithTimeout(const POINT& start,
183 const POINT& end, 183 const POINT& end,
184 int flags, 184 int flags,
185 uint32 timeout_ms, 185 uint32 timeout_ms,
186 bool* is_timeout, 186 bool* is_timeout,
187 bool press_escape_en_route) { 187 bool press_escape_en_route) {
188 if (!is_valid()) 188 if (!is_valid())
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 int autocomplete_edit_handle = 0; 389 int autocomplete_edit_handle = 0;
390 390
391 sender_->Send(new AutomationMsg_AutocompleteEditForBrowser( 391 sender_->Send(new AutomationMsg_AutocompleteEditForBrowser(
392 0, handle_, &handle_ok, &autocomplete_edit_handle)); 392 0, handle_, &handle_ok, &autocomplete_edit_handle));
393 393
394 if (!handle_ok) 394 if (!handle_ok)
395 return NULL; 395 return NULL;
396 396
397 return new AutocompleteEditProxy(sender_, tracker_, autocomplete_edit_handle); 397 return new AutocompleteEditProxy(sender_, tracker_, autocomplete_edit_handle);
398 } 398 }
OLDNEW
« no previous file with comments | « chrome/test/automation/browser_proxy.h ('k') | chrome/test/automation/tab_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698