diff options
Diffstat (limited to 'chrome_frame/test/chrome_frame_test_utils.h')
-rw-r--r-- | chrome_frame/test/chrome_frame_test_utils.h | 59 |
1 files changed, 13 insertions, 46 deletions
diff --git a/chrome_frame/test/chrome_frame_test_utils.h b/chrome_frame/test/chrome_frame_test_utils.h index 8c0983f..95a0a4f 100644 --- a/chrome_frame/test/chrome_frame_test_utils.h +++ b/chrome_frame/test/chrome_frame_test_utils.h @@ -22,35 +22,13 @@ #include "base/scoped_variant_win.h" #include "chrome_frame/test_utils.h" +#include "chrome_frame/test/simulate_input.h" // Include without path to make GYP build see it. #include "chrome_tab.h" // NOLINT namespace chrome_frame_test { -bool IsTopLevelWindow(HWND window); int CloseVisibleWindowsOnAllThreads(HANDLE process); -bool ForceSetForegroundWindow(HWND window); -bool EnsureProcessInForeground(base::ProcessId process_id); - -// Iterates through all the characters in the string and simulates -// keyboard input. The input goes to the currently active application. -bool SendString(const wchar_t* s); - -// Sends a virtual key such as VK_TAB, VK_RETURN or a character that has been -// translated to a virtual key. -// The extended flag indicates if this is an extended key -void SendVirtualKey(int16 key, bool extended); - -// Translates a single char to a virtual key and calls SendVirtualKey. -void SendChar(char c); - -// Sends an ascii string, char by char (calls SendChar for each). -void SendString(const char* s); - -// Sends a keystroke to the currently active application with optional -// modifiers set. -bool SendMnemonic(WORD mnemonic_char, bool shift_pressed, bool control_pressed, - bool alt_pressed); base::ProcessHandle LaunchFirefox(const std::wstring& url); base::ProcessHandle LaunchOpera(const std::wstring& url); @@ -72,26 +50,6 @@ extern const wchar_t kOperaImageName[]; extern const wchar_t kSafariImageName[]; extern const wchar_t kChromeImageName[]; -// Displays the chrome frame context menu by posting mouse move messages to -// Chrome -void ShowChromeFrameContextMenu(); - -// Sends keyboard messages to the chrome frame context menu to select the About -// Chrome frame option. -void SelectAboutChromeFrame(); - -// Returns a handle to the chrome frame render widget child window. -// Returns NULL on failure. -HWND GetChromeRendererWindow(); - -// Sends the specified input to the window passed in. -void SendInputToWindow(HWND window, const std::string& input_string); - -// Helper function to set keyboard focus to a window. This is achieved by -// sending a mouse move followed by a mouse down/mouse up combination to the -// window. -void SetKeyboardFocusToWindow(HWND window, int x, int y); - // Temporarily impersonate the current thread to low integrity for the lifetime // of the object. Destructor will automatically revert integrity level. class LowIntegrityToken { @@ -202,7 +160,14 @@ class WebBrowserEventSink // Send keyboard input to the renderer window hosted in chrome using // SendInput API - void SendInputToChrome(const std::string& input_string); + void SendKeys(const wchar_t* input_string); + + // Send mouse click to the renderer window hosted in chrome using + // SendInput API + void SendMouseClick(int x, int y, simulate_input::MouseButton button); + + void Exec(const GUID* cmd_group_guid, DWORD command_id, + DWORD cmd_exec_opt, VARIANT* in_args, VARIANT* out_args); BEGIN_COM_MAP(WebBrowserEventSink) END_COM_MAP() @@ -257,7 +222,8 @@ END_SINK_MAP() // Chrome frame callbacks virtual void OnLoad(const wchar_t* url) {} virtual void OnLoadError(const wchar_t* url) {} - virtual void OnMessage(const wchar_t* message) {} + virtual void OnMessage(const wchar_t* message, const wchar_t* origin, + const wchar_t* source) {} IWebBrowser2* web_browser2() { return web_browser2_.get(); @@ -266,6 +232,7 @@ END_SINK_MAP() virtual void OnNewBrowserWindow(IDispatch* new_window, const wchar_t* url) {} HRESULT SetWebBrowser(IWebBrowser2* web_browser2); + void ExpectRendererWindowHasfocus(); protected: STDMETHOD(OnBeforeNavigate2Internal)(IDispatch* dispatch, VARIANT* url, @@ -288,7 +255,7 @@ END_SINK_MAP() void ConnectToChromeFrame(); void DisconnectFromChromeFrame(); - HWND GetTabWindow(); + HWND GetRendererWindow(); public: ScopedComPtr<IWebBrowser2> web_browser2_; |