Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 |
|
Nirnimesh
2011/03/07 19:54:43
It's ugly to have all the function names suffixed
| |
| 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 void ExecuteJavascriptJSON( | |
| 823 DictionaryValue* args, IPC::Message* reply_message); | |
| 824 | |
| 825 // Goes forward in the specified tab. Uses the JSON interface. | |
| 826 // Example: | |
| 827 // input: { "windex": 1, "tab_index": 1 } | |
| 828 // output: { "did_go_forward": true, // optional | |
| 829 // "result": AUTOMATION_MSG_NAVIGATION_SUCCESS // optional | |
| 830 // } | |
| 831 void GoForward(DictionaryValue* args, IPC::Message* reply_message); | |
| 832 | |
| 833 // Goes back in the specified tab. Uses the JSON interface. | |
| 834 // Example: | |
| 835 // input: { "windex": 1, "tab_index": 1 } | |
| 836 // output: { "did_go_back": true, // optional | |
| 837 // "result": AUTOMATION_MSG_NAVIGATION_SUCCESS // optional | |
| 838 // } | |
| 839 void GoBack(DictionaryValue* args, IPC::Message* reply_message); | |
| 840 | |
| 841 // Reload the specified tab. Uses the JSON interface. | |
| 842 // Example: | |
| 843 // input: { "windex": 1, "tab_index": 1 } | |
| 844 // output: { "result": AUTOMATION_MSG_NAVIGATION_SUCCESS // optional } | |
| 845 void ReloadJSON(DictionaryValue* args, IPC::Message* reply_message); | |
| 846 | |
| 847 // Get the current url of the specified tab. Uses the JSON interface. | |
| 848 // Example: | |
| 849 // input: { "windex": 1, "tab_index": 1 } | |
| 850 // output: { "url": "http://www.google.com" } | |
| 851 void GetTabURLJSON(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: { "title": "Google" } | |
| 857 void GetTabTitleJSON(DictionaryValue* args, IPC::Message* reply_message); | |
| 858 | |
| 859 // Gets the cookies for the given URL. Uses the JSON interface. | |
| 860 // Example: | |
| 861 // input: { "windex": 1, "tab_index": 1, "url": "http://www.google.com" } | |
| 862 // output: { "cookies": "PREF=12012" } | |
| 863 void GetCookiesJSON(DictionaryValue* args, IPC::Message* reply_message); | |
| 864 | |
| 865 // Deletes the cookie with the given name for the URL. Uses the JSON | |
| 866 // interface. | |
| 867 // Example: | |
| 868 // input: { "windex": 1, | |
| 869 // "tab_index": 1, | |
| 870 // "url": "http://www.google.com", | |
| 871 // "name": "my_cookie" | |
| 872 // } | |
| 873 // output: none | |
| 874 void DeleteCookieJSON(DictionaryValue* args, IPC::Message* reply_message); | |
| 875 | |
| 876 // Sets a cookie for the given URL. Uses the JSON interface. | |
| 877 // Example: | |
| 878 // input: { "windex": 1, | |
| 879 // "tab_index": 1, | |
| 880 // "url": "http://www.google.com", | |
| 881 // "cookie": "PREF=21321" | |
| 882 // } | |
| 883 // output: none | |
| 884 void SetCookieJSON(DictionaryValue* args, IPC::Message* reply_message); | |
| 885 | |
| 886 // Gets the ID for every open tab. This ID is unique per session. | |
| 887 // Example: | |
| 888 // input: none | |
| 889 // output: { "ids": [4124, 213, 1] } | |
| 890 void GetTabIds(DictionaryValue* args, IPC::Message* reply_message); | |
| 891 | |
| 892 // Checks if the given tab ID refers to an open tab. | |
| 893 // Example: | |
| 894 // input: { "id": 41 } | |
| 895 // output: { "is_valid": false } | |
| 896 void IsTabIdValid(DictionaryValue* args, IPC::Message* reply_message); | |
| 897 | |
| 898 // Closes the specified tab. | |
| 899 // Example: | |
| 900 // input: { "windex": 1, "tab_index": 1 } | |
| 901 // output: none | |
| 902 void CloseTabJSON(DictionaryValue* args, IPC::Message* reply_message); | |
| 903 | |
| 904 // Sends the WebKit events for a mouse click at a given coordinate. | |
| 905 // Example: | |
| 906 // input: { "windex": 1, | |
| 907 // "tab_index": 1, | |
| 908 // "button": automation::kLeftButton, | |
| 909 // "x": 100, | |
| 910 // "y": 100 | |
| 911 // } | |
| 912 // output: none | |
| 913 void WebkitMouseClick(DictionaryValue* args, | |
| 914 IPC::Message* message); | |
| 915 | |
| 916 // Sends the WebKit event for a mouse move to a given coordinate. | |
| 917 // Example: | |
| 918 // input: { "windex": 1, | |
| 919 // "tab_index": 1, | |
| 920 // "x": 100, | |
| 921 // "y": 100 | |
| 922 // } | |
| 923 // output: none | |
| 924 void WebkitMouseMove(DictionaryValue* args, | |
| 925 IPC::Message* message); | |
| 926 | |
| 927 // Sends the WebKit events for a mouse drag between two coordinates. | |
| 928 // Example: | |
| 929 // input: { "windex": 1, | |
| 930 // "tab_index": 1, | |
| 931 // "start_x": 100, | |
| 932 // "start_y": 100, | |
| 933 // "end_x": 100, | |
| 934 // "end_y": 100 | |
| 935 // } | |
| 936 // output: none | |
| 937 void WebkitMouseDrag(DictionaryValue* args, | |
| 938 IPC::Message* message); | |
| 939 | |
| 940 // Sends the WebKit key event with the specified properties. | |
| 941 // Example: | |
| 942 // input: { "windex": 1, | |
| 943 // "tab_index": 1, | |
| 944 // "type": automation::kRawKeyDownType, | |
| 945 // "nativeKeyCode": ui::VKEY_X, | |
| 946 // "windowsKeyCode": ui::VKEY_X, | |
| 947 // "unmodifiedText": "x", | |
| 948 // "text": "X", | |
| 949 // "modifiers": automation::kShiftKeyMask, | |
| 950 // "isSystemKey": false | |
| 951 // } | |
| 952 // output: none | |
| 953 void SendWebkitKeyEvent(DictionaryValue* args, | |
| 954 IPC::Message* message); | |
| 955 | |
| 956 // Activates the given tab. | |
| 957 // Example: | |
| 958 // input: { "windex": 1, | |
| 959 // "tab_index": 1, | |
| 960 // } | |
| 961 // output: none | |
| 962 void ActivateTabJSON(DictionaryValue* args, IPC::Message* message); | |
| 963 | |
| 817 #if defined(OS_CHROMEOS) | 964 #if defined(OS_CHROMEOS) |
| 818 void LoginAsGuest(DictionaryValue* args, IPC::Message* reply_message); | 965 void LoginAsGuest(DictionaryValue* args, IPC::Message* reply_message); |
| 819 | 966 |
| 820 void Login(DictionaryValue* args, IPC::Message* reply_message); | 967 void Login(DictionaryValue* args, IPC::Message* reply_message); |
| 821 | 968 |
| 822 void Logout(DictionaryValue* args, IPC::Message* reply_message); | 969 void Logout(DictionaryValue* args, IPC::Message* reply_message); |
| 823 | 970 |
| 824 void ScreenLock(DictionaryValue* args, IPC::Message* reply_message); | 971 void ScreenLock(DictionaryValue* args, IPC::Message* reply_message); |
| 825 | 972 |
| 826 void ScreenUnlock(DictionaryValue* args, IPC::Message* reply_message); | 973 void ScreenUnlock(DictionaryValue* args, IPC::Message* reply_message); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 889 // Used to enumerate browser profiles. | 1036 // Used to enumerate browser profiles. |
| 890 scoped_refptr<ImporterList> importer_list_; | 1037 scoped_refptr<ImporterList> importer_list_; |
| 891 | 1038 |
| 892 // The stored data for the ImportSettings operation. | 1039 // The stored data for the ImportSettings operation. |
| 893 ImportSettingsData import_settings_data_; | 1040 ImportSettingsData import_settings_data_; |
| 894 | 1041 |
| 895 DISALLOW_COPY_AND_ASSIGN(TestingAutomationProvider); | 1042 DISALLOW_COPY_AND_ASSIGN(TestingAutomationProvider); |
| 896 }; | 1043 }; |
| 897 | 1044 |
| 898 #endif // CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_ | 1045 #endif // CHROME_BROWSER_AUTOMATION_TESTING_AUTOMATION_PROVIDER_H_ |
| OLD | NEW |