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

Side by Side Diff: chrome/browser/automation/testing_automation_provider.h

Issue 6614023: Convert ChromeDriver to use only the JSON automation interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address Pawel's additional comments 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_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_
6 #define CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_ 6 #define CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 void GetWindowBounds(int handle, gfx::Rect* bounds, bool* result); 111 void GetWindowBounds(int handle, gfx::Rect* bounds, bool* result);
112 void SetWindowBounds(int handle, const gfx::Rect& bounds, bool* result); 112 void SetWindowBounds(int handle, const gfx::Rect& bounds, bool* result);
113 void SetWindowVisible(int handle, bool visible, bool* result); 113 void SetWindowVisible(int handle, bool visible, bool* result);
114 void WindowSimulateClick(const IPC::Message& message, 114 void WindowSimulateClick(const IPC::Message& message,
115 int handle, 115 int handle,
116 const gfx::Point& click, 116 const gfx::Point& click,
117 int flags); 117 int flags);
118 void WindowSimulateMouseMove(const IPC::Message& message, 118 void WindowSimulateMouseMove(const IPC::Message& message,
119 int handle, 119 int handle,
120 const gfx::Point& location); 120 const gfx::Point& location);
121 // The Webkit mouse functions below work on the currently selected
122 // tab.
123 void WebkitMouseClick(Browser* browser,
124 DictionaryValue* args,
125 IPC::Message* message);
126 void WebkitMouseMove(Browser* browser,
127 DictionaryValue* args,
128 IPC::Message* message);
129 void WebkitMouseDrag(Browser* browser,
130 DictionaryValue* args,
131 IPC::Message* message);
132 void WindowSimulateKeyPress(const IPC::Message& message, 121 void WindowSimulateKeyPress(const IPC::Message& message,
133 int handle, 122 int handle,
134 int key, 123 int key,
135 int flags); 124 int flags);
136 void GetTabCount(int handle, int* tab_count); 125 void GetTabCount(int handle, int* tab_count);
137 void GetType(int handle, int* type_as_int); 126 void GetType(int handle, int* type_as_int);
138 void GetTab(int win_handle, int tab_index, int* tab_handle); 127 void GetTab(int win_handle, int tab_index, int* tab_handle);
139 void GetTabProcessID(int handle, int* process_id); 128 void GetTabProcessID(int handle, int* process_id);
140 void GetTabTitle(int handle, int* title_string_size, std::wstring* title); 129 void GetTabTitle(int handle, int* title_string_size, std::wstring* title);
141 void GetTabIndex(int handle, int* tabstrip_index); 130 void GetTabIndex(int handle, int* tabstrip_index);
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 // Puts or removes the specified section of the NTP into/from menu mode. 781 // Puts or removes the specified section of the NTP into/from menu mode.
793 void SetNTPMenuMode(Browser* browser, 782 void SetNTPMenuMode(Browser* browser,
794 DictionaryValue* args, 783 DictionaryValue* args,
795 IPC::Message* reply_message); 784 IPC::Message* reply_message);
796 785
797 // Waits for all tabs to stop loading. 786 // Waits for all tabs to stop loading.
798 void WaitForAllTabsToStopLoading(DictionaryValue* args, 787 void WaitForAllTabsToStopLoading(DictionaryValue* args,
799 IPC::Message* reply_message); 788 IPC::Message* reply_message);
800 789
801 // Gets the browser and tab index of the given tab. Uses the JSON interface. 790 // Gets the browser and tab index of the given tab. Uses the JSON interface.
791 // Either "tab_id" or "tab_handle" must be specified, but not both. "tab_id"
792 // refers to the ID from the |NavigationController|, while "tab_handle" is
793 // the handle number assigned by the automation system.
802 // Example: 794 // Example:
803 // input: { "tab_handle": 3 } 795 // input: { "tab_id": 1, // optional
804 // output: { "browser_index": 1, "tab_index": 5 } 796 // "tab_handle": 3 // optional
797 // }
798 // output: { "windex": 1, "tab_index": 5 }
805 void GetIndicesFromTab(DictionaryValue* args, IPC::Message* reply_message); 799 void GetIndicesFromTab(DictionaryValue* args, IPC::Message* reply_message);
806 800
807 // Navigates to the given URL. Uses the JSON interface. 801 // Navigates to the given URL. Uses the JSON interface.
808 // Example: 802 // Example:
809 // input: { "browser_index": 1, 803 // input: { "windex": 1,
810 // "tab_index": 3, 804 // "tab_index": 3,
811 // "url": "http://www.google.com", 805 // "url": "http://www.google.com",
812 // "navigation_count": 1 // number of navigations to wait for 806 // "navigation_count": 1 // number of navigations to wait for
813 // } 807 // }
814 // output: { "result": AUTOMATION_MSG_NAVIGATION_SUCCESS } 808 // output: { "result": AUTOMATION_MSG_NAVIGATION_SUCCESS }
815 void NavigateToURL(DictionaryValue* args, IPC::Message* reply_message); 809 void NavigateToURL(DictionaryValue* args, IPC::Message* reply_message);
816 810
811 // Executes javascript in the specified frame. Uses the JSON interface.
812 // Waits for a result from the |DOMAutomationController|. The javascript
813 // must send a string.
814 // Example:
815 // input: { "windex": 1,
816 // "tab_index": 1,
817 // "frame_xpath": "//frames[1]",
818 // "javascript":
819 // "window.domAutomationController.send(window.name)",
820 // }
821 // output: { "result": "My Window Name" }
822 // This and some following methods have a suffix of JSON to distingush them
823 // from already existing methods which perform the same function, but use
824 // custom IPC messages instead of the JSON IPC message. These functions will
825 // eventually be replaced with the JSON ones and the JSON suffix will be
826 // dropped.
827 // TODO(kkania): Replace the non-JSON counterparts and drop the JSON suffix.
828 void ExecuteJavascriptJSON(
829 DictionaryValue* args, IPC::Message* reply_message);
830
831 // Goes forward in the specified tab. Uses the JSON interface.
832 // Example:
833 // input: { "windex": 1, "tab_index": 1 }
834 // output: { "did_go_forward": true, // optional
835 // "result": AUTOMATION_MSG_NAVIGATION_SUCCESS // optional
836 // }
837 void GoForward(DictionaryValue* args, IPC::Message* reply_message);
838
839 // Goes back in the specified tab. Uses the JSON interface.
840 // Example:
841 // input: { "windex": 1, "tab_index": 1 }
842 // output: { "did_go_back": true, // optional
843 // "result": AUTOMATION_MSG_NAVIGATION_SUCCESS // optional
844 // }
845 void GoBack(DictionaryValue* args, IPC::Message* reply_message);
846
847 // Reload the specified tab. Uses the JSON interface.
848 // Example:
849 // input: { "windex": 1, "tab_index": 1 }
850 // output: { "result": AUTOMATION_MSG_NAVIGATION_SUCCESS // optional }
851 void ReloadJSON(DictionaryValue* args, IPC::Message* reply_message);
852
853 // Get the current url of the specified tab. Uses the JSON interface.
854 // Example:
855 // input: { "windex": 1, "tab_index": 1 }
856 // output: { "url": "http://www.google.com" }
857 void GetTabURLJSON(DictionaryValue* args, IPC::Message* reply_message);
858
859 // Get the current url of the specified tab. Uses the JSON interface.
860 // Example:
861 // input: { "windex": 1, "tab_index": 1 }
862 // output: { "title": "Google" }
863 void GetTabTitleJSON(DictionaryValue* args, IPC::Message* reply_message);
864
865 // Gets the cookies for the given URL. Uses the JSON interface.
866 // Example:
867 // input: { "windex": 1, "tab_index": 1, "url": "http://www.google.com" }
868 // output: { "cookies": "PREF=12012" }
869 void GetCookiesJSON(DictionaryValue* args, IPC::Message* reply_message);
870
871 // Deletes the cookie with the given name for the URL. Uses the JSON
872 // interface.
873 // Example:
874 // input: { "windex": 1,
875 // "tab_index": 1,
876 // "url": "http://www.google.com",
877 // "name": "my_cookie"
878 // }
879 // output: none
880 void DeleteCookieJSON(DictionaryValue* args, IPC::Message* reply_message);
881
882 // Sets a cookie for the given URL. Uses the JSON interface.
883 // Example:
884 // input: { "windex": 1,
885 // "tab_index": 1,
886 // "url": "http://www.google.com",
887 // "cookie": "PREF=21321"
888 // }
889 // output: none
890 void SetCookieJSON(DictionaryValue* args, IPC::Message* reply_message);
891
892 // Gets the ID for every open tab. This ID is unique per session.
893 // Example:
894 // input: none
895 // output: { "ids": [4124, 213, 1] }
896 void GetTabIds(DictionaryValue* args, IPC::Message* reply_message);
897
898 // Checks if the given tab ID refers to an open tab.
899 // Example:
900 // input: { "id": 41 }
901 // output: { "is_valid": false }
902 void IsTabIdValid(DictionaryValue* args, IPC::Message* reply_message);
903
904 // Closes the specified tab.
905 // Example:
906 // input: { "windex": 1, "tab_index": 1 }
907 // output: none
908 void CloseTabJSON(DictionaryValue* args, IPC::Message* reply_message);
909
910 // Sends the WebKit events for a mouse click at a given coordinate.
911 // Example:
912 // input: { "windex": 1,
913 // "tab_index": 1,
914 // "button": automation::kLeftButton,
915 // "x": 100,
916 // "y": 100
917 // }
918 // output: none
919 void WebkitMouseClick(DictionaryValue* args,
920 IPC::Message* message);
921
922 // Sends the WebKit event for a mouse move to a given coordinate.
923 // Example:
924 // input: { "windex": 1,
925 // "tab_index": 1,
926 // "x": 100,
927 // "y": 100
928 // }
929 // output: none
930 void WebkitMouseMove(DictionaryValue* args,
931 IPC::Message* message);
932
933 // Sends the WebKit events for a mouse drag between two coordinates.
934 // Example:
935 // input: { "windex": 1,
936 // "tab_index": 1,
937 // "start_x": 100,
938 // "start_y": 100,
939 // "end_x": 100,
940 // "end_y": 100
941 // }
942 // output: none
943 void WebkitMouseDrag(DictionaryValue* args,
944 IPC::Message* message);
945
946 // Sends the WebKit key event with the specified properties.
947 // Example:
948 // input: { "windex": 1,
949 // "tab_index": 1,
950 // "type": automation::kRawKeyDownType,
951 // "nativeKeyCode": ui::VKEY_X,
952 // "windowsKeyCode": ui::VKEY_X,
953 // "unmodifiedText": "x",
954 // "text": "X",
955 // "modifiers": automation::kShiftKeyMask,
956 // "isSystemKey": false
957 // }
958 // output: none
959 void SendWebkitKeyEvent(DictionaryValue* args,
960 IPC::Message* message);
961
962 // Activates the given tab.
963 // Example:
964 // input: { "windex": 1,
965 // "tab_index": 1,
966 // }
967 // output: none
968 void ActivateTabJSON(DictionaryValue* args, IPC::Message* message);
969
817 #if defined(OS_CHROMEOS) 970 #if defined(OS_CHROMEOS)
818 void LoginAsGuest(DictionaryValue* args, IPC::Message* reply_message); 971 void LoginAsGuest(DictionaryValue* args, IPC::Message* reply_message);
819 972
820 void Login(DictionaryValue* args, IPC::Message* reply_message); 973 void Login(DictionaryValue* args, IPC::Message* reply_message);
821 974
822 void Logout(DictionaryValue* args, IPC::Message* reply_message); 975 void Logout(DictionaryValue* args, IPC::Message* reply_message);
823 976
824 void ScreenLock(DictionaryValue* args, IPC::Message* reply_message); 977 void ScreenLock(DictionaryValue* args, IPC::Message* reply_message);
825 978
826 void ScreenUnlock(DictionaryValue* args, IPC::Message* reply_message); 979 void ScreenUnlock(DictionaryValue* args, IPC::Message* reply_message);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 // Used to enumerate browser profiles. 1042 // Used to enumerate browser profiles.
890 scoped_refptr<ImporterList> importer_list_; 1043 scoped_refptr<ImporterList> importer_list_;
891 1044
892 // The stored data for the ImportSettings operation. 1045 // The stored data for the ImportSettings operation.
893 ImportSettingsData import_settings_data_; 1046 ImportSettingsData import_settings_data_;
894 1047
895 DISALLOW_COPY_AND_ASSIGN(TestingAutomationProvider); 1048 DISALLOW_COPY_AND_ASSIGN(TestingAutomationProvider);
896 }; 1049 };
897 1050
898 #endif // CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_ 1051 #endif // CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_provider_observers.cc ('k') | chrome/browser/automation/testing_automation_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698