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

Side by Side Diff: chrome/test/webdriver/session.h

Issue 5572001: Send screenshots back to the client for debugging (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: for review, still need to add a few more tests Created 9 years, 9 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
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 #ifndef CHROME_TEST_WEBDRIVER_SESSION_H_ 5 #ifndef CHROME_TEST_WEBDRIVER_SESSION_H_
6 #define CHROME_TEST_WEBDRIVER_SESSION_H_ 6 #define CHROME_TEST_WEBDRIVER_SESSION_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 bool GoBack(); 96 bool GoBack();
97 bool Reload(); 97 bool Reload();
98 bool GetURL(GURL* url); 98 bool GetURL(GURL* url);
99 bool GetURL(std::string* url); 99 bool GetURL(std::string* url);
100 bool GetTabTitle(std::string* tab_title); 100 bool GetTabTitle(std::string* tab_title);
101 bool GetCookies(const GURL& url, std::string* cookies); 101 bool GetCookies(const GURL& url, std::string* cookies);
102 bool GetCookieByName(const GURL& url, const std::string& cookie_name, 102 bool GetCookieByName(const GURL& url, const std::string& cookie_name,
103 std::string* cookie); 103 std::string* cookie);
104 bool DeleteCookie(const GURL& url, const std::string& cookie_name); 104 bool DeleteCookie(const GURL& url, const std::string& cookie_name);
105 bool SetCookie(const GURL& url, const std::string& cookie); 105 bool SetCookie(const GURL& url, const std::string& cookie);
106 bool CaptureEntirePageAsPNG(std::string* png);
kkania 2011/03/16 18:19:10 I see you didn't change this one to GetScreenShot.
Joe 2011/03/17 00:15:25 Renamed functions On 2011/03/16 18:19:10, kkania w
106 107
107 // Gets all the currently existing window IDs. Returns true on success. 108 // Gets all the currently existing window IDs. Returns true on success.
108 bool GetWindowIds(std::vector<int>* window_ids); 109 bool GetWindowIds(std::vector<int>* window_ids);
109 110
110 // Switches the window used by default. |name| is either an ID returned by 111 // Switches the window used by default. |name| is either an ID returned by
111 // |GetWindowIds| or the name attribute of a DOM window. 112 // |GetWindowIds| or the name attribute of a DOM window.
112 ErrorCode SwitchToWindow(const std::string& name); 113 ErrorCode SwitchToWindow(const std::string& name);
113 114
114 // Switches the frame used by default. |name_or_id| is either the name or id 115 // Switches the frame used by default. |name_or_id| is either the name or id
115 // of a frame element. 116 // of a frame element.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 167
167 // Gets the top and left element border widths for the given frame. 168 // Gets the top and left element border widths for the given frame.
168 ErrorCode GetElementBorder(const FrameId& frame_id, 169 ErrorCode GetElementBorder(const FrameId& frame_id,
169 const WebElementId& element, 170 const WebElementId& element,
170 int* border_left, 171 int* border_left,
171 int* border_top); 172 int* border_top);
172 173
173 // Waits for all tabs to stop loading. Returns true on success. 174 // Waits for all tabs to stop loading. Returns true on success.
174 bool WaitForAllTabsToStopLoading(); 175 bool WaitForAllTabsToStopLoading();
175 176
176 inline const std::string& id() const { return id_; } 177 const std::string& id() const;
177 178
178 inline int implicit_wait() const { return implicit_wait_; } 179 int implicit_wait() const;
179 inline void set_implicit_wait(const int& timeout) { 180 void set_implicit_wait(const int& timeout);
180 implicit_wait_ = timeout > 0 ? timeout : 0;
181 }
182 181
183 enum Speed { kSlow, kMedium, kFast, kUnknown }; 182 enum Speed { kSlow, kMedium, kFast, kUnknown };
184 inline Speed speed() { return speed_; } 183 Speed speed();
185 inline void set_speed(Speed speed) { 184 void set_speed(Speed speed);
186 speed_ = speed; 185
187 } 186 // Since screenshots can be very large when in base64 PNG format; the
187 // client is allowed to dyamically enable/disable screenshots on error
188 // during the lifetime of the session.
189 bool get_screenshot_on_error() const;
190 void set_screenshot_on_error(const bool error);
kkania 2011/03/16 18:19:10 get rid of const before bool here.
Joe 2011/03/17 00:15:25 Done.
188 191
189 const FrameId& current_target() const; 192 const FrameId& current_target() const;
190 193
191 private: 194 private:
192 void RunSessionTask(Task* task); 195 void RunSessionTask(Task* task);
193 void RunSessionTaskOnSessionThread( 196 void RunSessionTaskOnSessionThread(
194 Task* task, 197 Task* task,
195 base::WaitableEvent* done_event); 198 base::WaitableEvent* done_event);
196 void InitOnSessionThread(const FilePath& browser_dir, bool* success); 199 void InitOnSessionThread(const FilePath& browser_dir, bool* success);
197 void TerminateOnSessionThread(); 200 void TerminateOnSessionThread();
(...skipping 11 matching lines...) Expand all
209 const WebElementId& element, 212 const WebElementId& element,
210 const gfx::Rect& region, 213 const gfx::Rect& region,
211 gfx::Point* location); 214 gfx::Point* location);
212 215
213 const std::string id_; 216 const std::string id_;
214 217
215 scoped_ptr<Automation> automation_; 218 scoped_ptr<Automation> automation_;
216 base::Thread thread_; 219 base::Thread thread_;
217 220
218 int implicit_wait_; 221 int implicit_wait_;
222 bool screenshot_on_error_;
219 Speed speed_; 223 Speed speed_;
220 224
221 FrameId current_target_; 225 FrameId current_target_;
222 226
223 DISALLOW_COPY_AND_ASSIGN(Session); 227 DISALLOW_COPY_AND_ASSIGN(Session);
224 }; 228 };
225 229
226 } // namespace webdriver 230 } // namespace webdriver
227 231
228 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Session); 232 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Session);
229 233
230 #endif // CHROME_TEST_WEBDRIVER_SESSION_H_ 234 #endif // CHROME_TEST_WEBDRIVER_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698