Chromium Code Reviews| Index: chrome/test/automation/automation_proxy_uitest.cc |
| =================================================================== |
| --- chrome/test/automation/automation_proxy_uitest.cc (revision 66224) |
| +++ chrome/test/automation/automation_proxy_uitest.cc (working copy) |
| @@ -29,6 +29,7 @@ |
| #include "chrome/test/automation/autocomplete_edit_proxy.h" |
| #include "chrome/test/automation/automation_proxy_uitest.h" |
| #include "chrome/test/automation/browser_proxy.h" |
| +#include "chrome/test/automation/proxy_launcher.h" |
| #include "chrome/test/automation/tab_proxy.h" |
| #include "chrome/test/automation/window_proxy.h" |
| #include "chrome/test/ui_test_utils.h" |
| @@ -47,6 +48,33 @@ |
| using testing::StrEq; |
| using testing::_; |
| +// Replace the default automation proxy with our mock client. |
| +class ExternalTabUITestMockLauncher : public ProxyLauncher { |
| + public: |
| + explicit ExternalTabUITestMockLauncher(ExternalTabUITestMockClient **mock) |
| + : mock_(mock) { |
| + channel_id_ = AutomationProxy::GenerateChannelID(); |
| + } |
| + |
| + AutomationProxy* CreateAutomationProxy(int execution_timeout) const { |
| + *mock_ = new ExternalTabUITestMockClient(execution_timeout); |
| + (*mock_)->InitializeChannel(channel_id_, false); |
| + return *mock_; |
| + } |
| + |
| + void InitializeConnection(UITestBase* ui_test_base) const { |
| + ui_test_base->LaunchBrowserAndServer(); |
| + } |
| + |
| + std::string PrefixedChannelID() const { |
| + return channel_id_; |
| + } |
| + |
| + private: |
| + ExternalTabUITestMockClient **mock_; |
| + std::string channel_id_; // Channel id of automation proxy. |
| +}; |
| + |
| class AutomationProxyTest : public UITest { |
| protected: |
| AutomationProxyTest() { |
| @@ -841,9 +869,8 @@ |
| return reinterpret_cast<T**>(&p); |
| } |
| -AutomationProxy* ExternalTabUITest::CreateAutomationProxy(int exec_timeout) { |
| - mock_ = new ExternalTabUITestMockClient(exec_timeout); |
| - return mock_; |
| +ProxyLauncher* ExternalTabUITest::CreateProxyLauncher() { |
| + return new ExternalTabUITestMockLauncher(&mock_); |
|
amit
2010/11/19 18:27:10
Ugg! Is there any better way to do this?
It's not
dtu
2010/11/19 19:37:08
Good idea. Even if it's not ideal it's better than
dtu
2010/11/24 06:29:23
Actually, it's not working, which i think is becau
|
| } |
| // Create with specifying a url |