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

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

Issue 8806030: Add commands to Chrome WebDriver for installing and manipulating extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 9 years 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/webdriver/webdriver_server.cc ('k') | chrome/test/webdriver/webdriver_session.cc » ('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 #ifndef CHROME_TEST_WEBDRIVER_WEBDRIVER_SESSION_H_ 5 #ifndef CHROME_TEST_WEBDRIVER_WEBDRIVER_SESSION_H_
6 #define CHROME_TEST_WEBDRIVER_WEBDRIVER_SESSION_H_ 6 #define CHROME_TEST_WEBDRIVER_WEBDRIVER_SESSION_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/callback_forward.h" 12 #include "base/callback_forward.h"
13 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/string16.h" 15 #include "base/string16.h"
16 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
17 #include "chrome/common/automation_constants.h" 17 #include "chrome/common/automation_constants.h"
18 #include "chrome/test/automation/automation_json_requests.h"
18 #include "chrome/test/webdriver/frame_path.h" 19 #include "chrome/test/webdriver/frame_path.h"
19 #include "chrome/test/webdriver/webdriver_automation.h" 20 #include "chrome/test/webdriver/webdriver_automation.h"
20 #include "chrome/test/webdriver/webdriver_basic_types.h" 21 #include "chrome/test/webdriver/webdriver_basic_types.h"
21 #include "chrome/test/webdriver/webdriver_element_id.h" 22 #include "chrome/test/webdriver/webdriver_element_id.h"
22 23
23 class FilePath; 24 class FilePath;
24 25
25 namespace base { 26 namespace base {
26 class DictionaryValue; 27 class DictionaryValue;
27 class ListValue; 28 class ListValue;
28 class Value; 29 class Value;
29 class WaitableEvent; 30 class WaitableEvent;
30 } 31 }
31 32
32 namespace webdriver { 33 namespace webdriver {
33 34
34 class Error; 35 class Error;
35 class ValueParser; 36 class ValueParser;
36 37
37 // A window ID and frame path combination that uniquely identifies a specific 38 // A view ID and frame path combination that uniquely identifies a specific
38 // frame within a session. 39 // frame within a session.
39 struct FrameId { 40 struct FrameId {
40 FrameId(int window_id, const FramePath& frame_path); 41 FrameId();
41 FrameId& operator=(const FrameId& other); 42 FrameId(const WebViewId& view_id, const FramePath& frame_path);
42 int window_id; 43
44 WebViewId view_id;
43 FramePath frame_path; 45 FramePath frame_path;
44 }; 46 };
45 47
46 // Every connection made by WebDriver maps to a session object. 48 // Every connection made by WebDriver maps to a session object.
47 // This object creates the chrome instance and keeps track of the 49 // This object creates the chrome instance and keeps track of the
48 // state necessary to control the chrome browser created. 50 // state necessary to control the chrome browser created.
49 // A session manages its own lifetime. 51 // A session manages its own lifetime.
50 class Session { 52 class Session {
51 public: 53 public:
52 struct Options { 54 struct Options {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 Error* GoForward(); 145 Error* GoForward();
144 Error* GoBack(); 146 Error* GoBack();
145 Error* Reload(); 147 Error* Reload();
146 Error* GetURL(std::string* url); 148 Error* GetURL(std::string* url);
147 Error* GetTitle(std::string* tab_title); 149 Error* GetTitle(std::string* tab_title);
148 Error* GetScreenShot(std::string* png); 150 Error* GetScreenShot(std::string* png);
149 Error* GetCookies(const std::string& url, base::ListValue** cookies); 151 Error* GetCookies(const std::string& url, base::ListValue** cookies);
150 Error* DeleteCookie(const std::string& url, const std::string& cookie_name); 152 Error* DeleteCookie(const std::string& url, const std::string& cookie_name);
151 Error* SetCookie(const std::string& url, base::DictionaryValue* cookie_dict); 153 Error* SetCookie(const std::string& url, base::DictionaryValue* cookie_dict);
152 154
153 // Gets all the currently existing window IDs. Returns true on success. 155 // Gets all the currently open views.
154 Error* GetWindowIds(std::vector<int>* window_ids); 156 Error* GetViews(std::vector<WebViewInfo>* views);
155 157
156 // Switches the window used by default. |name| is either an ID returned by 158 // Switches the view used by default. |id_or_name| is either a view ID
157 // |GetWindowIds| or the name attribute of a DOM window. 159 // returned by |GetViews| or the name attribute of a DOM window.
158 Error* SwitchToWindow(const std::string& name); 160 // Only tabs are considered when searching by name.
161 Error* SwitchToView(const std::string& id_or_name);
159 162
160 // Switches the frame used by default. |name_or_id| is either the name or id 163 // Switches the frame used by default. |name_or_id| is either the name or id
161 // of a frame element. 164 // of a frame element.
162 Error* SwitchToFrameWithNameOrId(const std::string& name_or_id); 165 Error* SwitchToFrameWithNameOrId(const std::string& name_or_id);
163 166
164 // Switches the frame used by default. |index| is the zero-based frame index. 167 // Switches the frame used by default. |index| is the zero-based frame index.
165 Error* SwitchToFrameWithIndex(int index); 168 Error* SwitchToFrameWithIndex(int index);
166 169
167 // Switches to the frame identified by the given |element|. The element must 170 // Switches to the frame identified by the given |element|. The element must
168 // be either an IFRAME or FRAME element. 171 // be either an IFRAME or FRAME element.
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 // location of the element. If the element is not clickable, or if the 300 // location of the element. If the element is not clickable, or if the
298 // location cannot be determined, an error will be returned. 301 // location cannot be determined, an error will be returned.
299 Error* GetClickableLocation(const ElementId& element, 302 Error* GetClickableLocation(const ElementId& element,
300 Point* location); 303 Point* location);
301 304
302 // Gets the attribute of the given element. If there are no errors, the 305 // Gets the attribute of the given element. If there are no errors, the
303 // function sets |value| and the caller takes ownership. 306 // function sets |value| and the caller takes ownership.
304 Error* GetAttribute(const ElementId& element, const std::string& key, 307 Error* GetAttribute(const ElementId& element, const std::string& key,
305 base::Value** value); 308 base::Value** value);
306 309
307 // Waits for all tabs to stop loading. Returns true on success. 310 // Waits for all views to stop loading. Returns true on success.
308 Error* WaitForAllTabsToStopLoading(); 311 Error* WaitForAllViewsToStopLoading();
309 312
310 // Install packed extension at |path|. 313 // Install packed extension at |path|.
311 Error* InstallExtensionDeprecated(const FilePath& path); 314 Error* InstallExtensionDeprecated(const FilePath& path);
312 315
313 // Get installed extensions IDs.
314 Error* GetInstalledExtensions(std::vector<std::string>* extension_ids);
315
316 // Install extension at |path|. 316 // Install extension at |path|.
317 Error* InstallExtension(const FilePath& path, std::string* extension_id); 317 Error* InstallExtension(const FilePath& path, std::string* extension_id);
318 318
319 Error* GetExtensionsInfo(base::ListValue* extension_ids);
320
321 Error* IsPageActionVisible(const WebViewId& tab_id,
322 const std::string& extension_id,
323 bool* is_visible);
324
325 Error* SetExtensionState(const std::string& extension_id,
326 bool enable);
327
328 Error* ClickExtensionButton(const std::string& extension_id,
329 bool browser_action);
330
331 Error* UninstallExtension(const std::string& extension_id);
332
319 const std::string& id() const; 333 const std::string& id() const;
320 334
321 const FrameId& current_target() const; 335 const FrameId& current_target() const;
322 336
323 void set_async_script_timeout(int timeout_ms); 337 void set_async_script_timeout(int timeout_ms);
324 int async_script_timeout() const; 338 int async_script_timeout() const;
325 339
326 void set_implicit_wait(int timeout_ms); 340 void set_implicit_wait(int timeout_ms);
327 int implicit_wait() const; 341 int implicit_wait() const;
328 342
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 Options options_; 430 Options options_;
417 431
418 DISALLOW_COPY_AND_ASSIGN(Session); 432 DISALLOW_COPY_AND_ASSIGN(Session);
419 }; 433 };
420 434
421 } // namespace webdriver 435 } // namespace webdriver
422 436
423 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Session); 437 DISABLE_RUNNABLE_METHOD_REFCOUNT(webdriver::Session);
424 438
425 #endif // CHROME_TEST_WEBDRIVER_WEBDRIVER_SESSION_H_ 439 #endif // CHROME_TEST_WEBDRIVER_WEBDRIVER_SESSION_H_
OLDNEW
« no previous file with comments | « chrome/test/webdriver/webdriver_server.cc ('k') | chrome/test/webdriver/webdriver_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698