diff options
author | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-06 22:49:45 +0000 |
---|---|---|
committer | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-06 22:49:45 +0000 |
commit | 5f8af2aa221fd2fba282dd51dc0837829cd48967 (patch) | |
tree | d81334eb34cce1b935767194a829d650116b1213 /chrome/browser/automation | |
parent | b63cbfaf62c1119b1f4b715d0186e516a2444600 (diff) | |
download | chromium_src-5f8af2aa221fd2fba282dd51dc0837829cd48967.zip chromium_src-5f8af2aa221fd2fba282dd51dc0837829cd48967.tar.gz chromium_src-5f8af2aa221fd2fba282dd51dc0837829cd48967.tar.bz2 |
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
Diffstat (limited to 'chrome/browser/automation')
-rw-r--r-- | chrome/browser/automation/automation_provider.cc | 15 | ||||
-rw-r--r-- | chrome/browser/automation/automation_provider.h | 20 |
2 files changed, 26 insertions, 9 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 5636302..5c10d68 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -775,6 +775,8 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) { AutocompleteEditGetMatches) IPC_MESSAGE_HANDLER(AutomationMsg_ConstrainedWindowBoundsRequest, GetConstrainedWindowBounds) + IPC_MESSAGE_HANDLER(AutomationMsg_OpenFindInPageRequest, + HandleOpenFindInPageRequest) IPC_END_MESSAGE_MAP() } @@ -1096,7 +1098,6 @@ void AutomationProvider::GetWindowHWND(const IPC::Message& message, void AutomationProvider::ExecuteBrowserCommand(const IPC::Message& message, int handle, int command) { - bool success = false; if (browser_tracker_->ContainsHandle(handle)) { Browser* browser = browser_tracker_->GetResource(handle); @@ -1694,6 +1695,18 @@ void AutomationProvider::HandleFindInPageRequest( false); // Not a FindNext operation. } +void AutomationProvider::HandleOpenFindInPageRequest( + const IPC::Message& message, int handle) { + if (tab_tracker_->ContainsHandle(handle)) { + NavigationController* tab = tab_tracker_->GetResource(handle); + Browser* browser = Browser::GetBrowserForController(tab, NULL); + if (tab->active_contents()->AsWebContents()) { + WebContents* web_contents = tab->active_contents()->AsWebContents(); + web_contents->OpenFindInPageWindow(*browser); + } + } +} + void AutomationProvider::HandleInspectElementRequest( const IPC::Message& message, int handle, int x, int y) { if (!tab_tracker_->ContainsHandle(handle)) { diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index 85171d3..35827c8 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -33,8 +33,8 @@ // the BrowserProcess, and in particular the NotificationService that's // hung off of it. -#ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_H__ -#define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_H__ +#ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_H_ +#define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_H_ #include <map> #include <string> @@ -58,7 +58,7 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, public IPC::Channel::Listener, public IPC::Message::Sender { public: - AutomationProvider(Profile* profile); + explicit AutomationProvider(Profile* profile); virtual ~AutomationProvider(); // Establishes a connection to an automation client, if present. @@ -217,6 +217,10 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, int forward, int match_case); + // Responds to requests to open the FindInPage window. + void HandleOpenFindInPageRequest(const IPC::Message& message, + int handle); + // Responds to InspectElement request void HandleInspectElementRequest(const IPC::Message& message, int handle, @@ -353,10 +357,10 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, }; // When life started, the AutomationProvider class was a singleton and was meant -// only for UI tests. It had specific behavior (like for example, when the channel -// was shut down. it closed all open Browsers). The new AutomationProvider serves -// other purposes than just UI testing. This class is meant to provide the OLD -// functionality for backward compatibility +// only for UI tests. It had specific behavior (like for example, when the +// channel was shut down. it closed all open Browsers). The new +// AutomationProvider serves other purposes than just UI testing. This class is +// meant to provide the OLD functionality for backward compatibility class TestingAutomationProvider : public AutomationProvider, public BrowserList::Observer, public NotificationObserver { @@ -379,4 +383,4 @@ class TestingAutomationProvider : public AutomationProvider, const NotificationSource& source, const NotificationDetails& details); }; -#endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_H__ +#endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_H_ |