From 5f8af2aa221fd2fba282dd51dc0837829cd48967 Mon Sep 17 00:00:00 2001 From: "finnur@google.com" Date: Wed, 6 Aug 2008 22:49:45 +0000 Subject: Adding an interactive UI test to catch when switching between two tabs (both with FindInPage open) is trashing the Esc handler and causing a crash. I originally tried an automated_ui test, but was unable to get it to work since Focus changes are involved. BUG=1303709 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@466 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/test/automation/automation_messages_internal.h | 4 ++++ chrome/test/automation/tab_proxy.cc | 9 +++++++++ chrome/test/automation/tab_proxy.h | 10 +++++++--- chrome/test/interactive_ui/interactive_ui.vcproj | 8 ++++++++ 4 files changed, 28 insertions(+), 3 deletions(-) (limited to 'chrome/test') diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h index f6efda3..bbd1782 100644 --- a/chrome/test/automation/automation_messages_internal.h +++ b/chrome/test/automation/automation_messages_internal.h @@ -732,4 +732,8 @@ IPC_BEGIN_MESSAGES(Automation, 0) IPC_MESSAGE_ROUTED1(AutomationMsg_WindowExecuteCommandResponse, bool /* success flag */) + // This message opens the Find window within a tab corresponding to the + // supplied tab handle. + IPC_MESSAGE_ROUTED1(AutomationMsg_OpenFindInPageRequest, + int /* tab_handle */) IPC_END_MESSAGES(Automation) diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc index 4fb4432..2cca9a4 100644 --- a/chrome/test/automation/tab_proxy.cc +++ b/chrome/test/automation/tab_proxy.cc @@ -92,6 +92,15 @@ bool TabProxy::IsShelfVisible(bool* is_visible) { return true; } +bool TabProxy::OpenFindInPage() { + if (!is_valid()) + return false; + + return sender_->Send( + new AutomationMsg_OpenFindInPageRequest(0, handle_)); + // This message expects no response. +} + int TabProxy::FindInPage(const std::wstring& search_string, FindInPageDirection forward, FindInPageCase match_case) { diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h index 712ab9c..baa5a0f 100644 --- a/chrome/test/automation/tab_proxy.h +++ b/chrome/test/automation/tab_proxy.h @@ -27,8 +27,8 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#ifndef CHROME_TEST_AUTOMATION_TAB_PROXY_H__ -#define CHROME_TEST_AUTOMATION_TAB_PROXY_H__ +#ifndef CHROME_TEST_AUTOMATION_TAB_PROXY_H_ +#define CHROME_TEST_AUTOMATION_TAB_PROXY_H_ #include #include @@ -188,6 +188,10 @@ class TabProxy : public AutomationResourceProxy { // unchanged. bool IsShelfVisible(bool* is_visible); + // Opens the FindInPage box. Note: If you just want to search within a tab + // you don't need to call this function, just use FindInPage(...) directly. + bool OpenFindInPage(); + // Starts a search within the current tab. The parameter 'search_string' // specifies what string to search for, 'forward' specifies whether to search // in forward direction, and 'match_case' specifies case sensitivity @@ -263,4 +267,4 @@ class TabProxy : public AutomationResourceProxy { DISALLOW_EVIL_CONSTRUCTORS(TabProxy); }; -#endif // CHROME_TEST_AUTOMATION_TAB_PROXY_H__ +#endif // CHROME_TEST_AUTOMATION_TAB_PROXY_H_ diff --git a/chrome/test/interactive_ui/interactive_ui.vcproj b/chrome/test/interactive_ui/interactive_ui.vcproj index 56c649f..b29342a 100644 --- a/chrome/test/interactive_ui/interactive_ui.vcproj +++ b/chrome/test/interactive_ui/interactive_ui.vcproj @@ -180,6 +180,14 @@ + + + +