diff options
author | gavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-04 01:36:56 +0000 |
---|---|---|
committer | gavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-04 01:36:56 +0000 |
commit | ae7d85482dd44ffd2061fd6dc692f4d1ef769d18 (patch) | |
tree | bdd741ff6046d9cb3e6dd9de9c9b3c16e4d98efb /chrome/browser/automation | |
parent | 76b33b3711aaa11fb7b51c069a61d880a88d4e7c (diff) | |
download | chromium_src-ae7d85482dd44ffd2061fd6dc692f4d1ef769d18.zip chromium_src-ae7d85482dd44ffd2061fd6dc692f4d1ef769d18.tar.gz chromium_src-ae7d85482dd44ffd2061fd6dc692f4d1ef769d18.tar.bz2 |
Revert 58563 - GTTF: Make WaitForTabCountToBecome automation call not Sleep.
(unfortunately, Mac & Windows started failing tab perf tests on this change)
Sleeping is an unreliable method to wait for things.
Instead, we set up an observer.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3300011
TBR=phajdan.jr@chromium.org
Review URL: http://codereview.chromium.org/3344009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58566 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation')
4 files changed, 0 insertions, 98 deletions
diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc index a30e801..0107708 100644 --- a/chrome/browser/automation/automation_provider_observers.cc +++ b/chrome/browser/automation/automation_provider_observers.cc @@ -340,49 +340,6 @@ void TabClosedNotificationObserver::set_for_browser_command( for_browser_command_ = for_browser_command; } -TabCountChangeObserver::TabCountChangeObserver(AutomationProvider* automation, - Browser* browser, - IPC::Message* reply_message, - int target_tab_count) - : automation_(automation), - reply_message_(reply_message), - tab_strip_model_(browser->tabstrip_model()), - target_tab_count_(target_tab_count) { - tab_strip_model_->AddObserver(this); - CheckTabCount(); -} - -TabCountChangeObserver::~TabCountChangeObserver() { - tab_strip_model_->RemoveObserver(this); -} - -void TabCountChangeObserver::TabInsertedAt(TabContents* contents, - int index, - bool foreground) { - CheckTabCount(); -} - -void TabCountChangeObserver::TabClosingAt(TabContents* contents, int index) { - CheckTabCount(); -} - -void TabCountChangeObserver::TabStripModelDeleted() { - AutomationMsg_WaitForTabCountToBecome::WriteReplyParams(reply_message_, - false); - automation_->Send(reply_message_); - delete this; -} - -void TabCountChangeObserver::CheckTabCount() { - if (tab_strip_model_->count() != target_tab_count_) - return; - - AutomationMsg_WaitForTabCountToBecome::WriteReplyParams(reply_message_, - true); - automation_->Send(reply_message_); - delete this; -} - bool DidExtensionHostsStopLoading(ExtensionProcessManager* manager) { for (ExtensionProcessManager::const_iterator iter = manager->begin(); iter != manager->end(); ++iter) { diff --git a/chrome/browser/automation/automation_provider_observers.h b/chrome/browser/automation/automation_provider_observers.h index c9e3afd..e55fec8 100644 --- a/chrome/browser/automation/automation_provider_observers.h +++ b/chrome/browser/automation/automation_provider_observers.h @@ -19,7 +19,6 @@ #include "chrome/browser/importer/importer_data_types.h" #include "chrome/browser/password_manager/password_store.h" #include "chrome/browser/tab_contents/tab_contents.h" -#include "chrome/browser/tabs/tab_strip_model.h" #include "chrome/common/notification_observer.h" #include "chrome/common/notification_registrar.h" #include "chrome/common/notification_type.h" @@ -192,37 +191,6 @@ class TabClosedNotificationObserver : public TabStripNotificationObserver { DISALLOW_COPY_AND_ASSIGN(TabClosedNotificationObserver); }; -// Notifies when the tab count reaches the target number. -class TabCountChangeObserver : public TabStripModelObserver { - public: - TabCountChangeObserver(AutomationProvider* automation, - Browser* browser, - IPC::Message* reply_message, - int target_tab_count); - // Implementation of TabStripModelObserver. - virtual void TabInsertedAt(TabContents* contents, - int index, - bool foreground); - virtual void TabClosingAt(TabContents* contents, int index); - virtual void TabStripModelDeleted(); - - private: - ~TabCountChangeObserver(); - - // Checks if the current tab count matches our target, and if so, - // sends the reply message and deletes self. - void CheckTabCount(); - - AutomationProvider* automation_; - IPC::Message* reply_message_; - - TabStripModel* tab_strip_model_; - - const int target_tab_count_; - - DISALLOW_COPY_AND_ASSIGN(TabCountChangeObserver); -}; - // Observes when an extension has finished installing or possible install // errors. This does not guarantee that the extension is ready for use. class ExtensionInstallNotificationObserver : public NotificationObserver { diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 1a0afca..62e98a9 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -403,8 +403,6 @@ void TestingAutomationProvider::OnMessageReceived( IPC_MESSAGE_HANDLER(AutomationMsg_BlockedPopupCount, GetBlockedPopupCount) IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_SendJSONRequest, SendJSONRequest) - IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WaitForTabCountToBecome, - WaitForTabCountToBecome) IPC_MESSAGE_UNHANDLED(AutomationProvider::OnMessageReceived(message)); IPC_END_MESSAGE_MAP() @@ -3691,23 +3689,6 @@ std::map<AutoFillFieldType, std::wstring> return credit_card_type_to_string; } -void TestingAutomationProvider::WaitForTabCountToBecome( - int browser_handle, - int target_tab_count, - IPC::Message* reply_message) { - if (!browser_tracker_->ContainsHandle(browser_handle)) { - AutomationMsg_WaitForTabCountToBecome::WriteReplyParams(reply_message, - false); - Send(reply_message); - return; - } - - Browser* browser = browser_tracker_->GetResource(browser_handle); - - // The observer will delete itself. - new TabCountChangeObserver(this, browser, reply_message, target_tab_count); -} - // TODO(brettw) change this to accept GURLs when history supports it void TestingAutomationProvider::OnRedirectQueryComplete( HistoryService::Handle request_handle, diff --git a/chrome/browser/automation/testing_automation_provider.h b/chrome/browser/automation/testing_automation_provider.h index 565bd8c..10fe387 100644 --- a/chrome/browser/automation/testing_automation_provider.h +++ b/chrome/browser/automation/testing_automation_provider.h @@ -596,10 +596,6 @@ class TestingAutomationProvider : public AutomationProvider, static std::map<AutoFillFieldType, std::wstring> GetCreditCardFieldToStringMap(); - void WaitForTabCountToBecome(int browser_handle, - int target_tab_count, - IPC::Message* reply_message); - // Callback for history redirect queries. virtual void OnRedirectQueryComplete( HistoryService::Handle request_handle, |