summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-26 04:37:20 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-26 04:37:20 +0000
commit22a91288c8d235afb45932dd7633982a04c389f0 (patch)
tree431cd53b7ba02ad1d17bf370a7131fc4c308623d
parent58580359a452cb7c3b9580edc0843c3ab3d158df (diff)
downloadchromium_src-22a91288c8d235afb45932dd7633982a04c389f0.zip
chromium_src-22a91288c8d235afb45932dd7633982a04c389f0.tar.gz
chromium_src-22a91288c8d235afb45932dd7633982a04c389f0.tar.bz2
ChromeFrame network tests were broken since the change to honor the automation protocol
version in ChromeFrame which basically breaks the automation connection if the protocols don't match. While this is fine when chrome is the automation client, it breaks chrome frame net tests because when the automation channel is established the automation provider sends over the version of the current module in the hello message. In the case when the current module is chrome the version goes over correctly. For chrome frame net tests there is no version string. Hence the channel never gets established. Fix is to retrieve the protocol version via a virtual protected function in the automation provider. The testing automation provider overrides this function in the network tests and returns the version of chrome.dll TBR=amit,robertshield Review URL: http://codereview.chromium.org/4160002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63860 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/automation/automation_provider.cc8
-rw-r--r--chrome/browser/automation/automation_provider.h3
-rw-r--r--chrome_frame/test/net/test_automation_provider.cc18
-rw-r--r--chrome_frame/test/net/test_automation_provider.h3
4 files changed, 29 insertions, 3 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 24b2048..db4ad51 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -161,14 +161,18 @@ void AutomationProvider::ConnectToChannel(const std::string& channel_id) {
automation_resource_message_filter_,
g_browser_process->io_thread()->message_loop(),
true, g_browser_process->shutdown_event()));
- chrome::VersionInfo version_info;
// Send a hello message with our current automation protocol version.
- channel_->Send(new AutomationMsg_Hello(0, version_info.Version().c_str()));
+ channel_->Send(new AutomationMsg_Hello(0, GetProtocolVersion().c_str()));
TRACE_EVENT_END("AutomationProvider::ConnectToChannel", 0, "");
}
+std::string AutomationProvider::GetProtocolVersion() {
+ chrome::VersionInfo version_info;
+ return version_info.Version().c_str();
+}
+
void AutomationProvider::SetExpectedTabCount(size_t expected_tabs) {
if (expected_tabs == 0) {
Send(new AutomationMsg_InitialLoadsComplete(0));
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index 3063d2b..5a29b04 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -175,6 +175,9 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
// is not of the TabContents type.
TabContents* GetTabContentsForHandle(int handle, NavigationController** tab);
+ // Returns the protocol version which typically is the module version.
+ virtual std::string GetProtocolVersion();
+
scoped_ptr<AutomationAutocompleteEditTracker> autocomplete_edit_tracker_;
scoped_ptr<AutomationBrowserTracker> browser_tracker_;
scoped_ptr<InitialLoadObserver> initial_load_observer_;
diff --git a/chrome_frame/test/net/test_automation_provider.cc b/chrome_frame/test/net/test_automation_provider.cc
index 322bf87..7594f30 100644
--- a/chrome_frame/test/net/test_automation_provider.cc
+++ b/chrome_frame/test/net/test_automation_provider.cc
@@ -5,8 +5,9 @@
#include "chrome_frame/test/net/test_automation_provider.h"
#include "base/command_line.h"
+#include "base/file_version_info.h"
+#include "base/path_service.h"
#include "chrome/test/automation/automation_messages.h"
-
#include "chrome_frame/test/net/test_automation_resource_message_filter.h"
namespace {
@@ -98,6 +99,21 @@ URLRequestJob* TestAutomationProvider::Factory(URLRequest* request,
return NULL;
}
+std::string TestAutomationProvider::GetProtocolVersion() {
+ // Return the version of chrome.dll
+ FilePath path;
+ PathService::Get(base::DIR_MODULE, &path);
+ path = path.AppendASCII("chrome.dll");
+
+ std::string version;
+ scoped_ptr<FileVersionInfo> version_info(
+ FileVersionInfo::CreateFileVersionInfo(path));
+ if (version_info.get()) {
+ version = WideToASCII(version_info->product_version());
+ }
+ return version;
+}
+
// static
TestAutomationProvider* TestAutomationProvider::NewAutomationProvider(
Profile* p, const std::string& channel,
diff --git a/chrome_frame/test/net/test_automation_provider.h b/chrome_frame/test/net/test_automation_provider.h
index d462108..9d3f65b 100644
--- a/chrome_frame/test/net/test_automation_provider.h
+++ b/chrome_frame/test/net/test_automation_provider.h
@@ -4,6 +4,7 @@
#ifndef CHROME_FRAME_TEST_NET_TEST_AUTOMATION_PROVIDER_H_
#define CHROME_FRAME_TEST_NET_TEST_AUTOMATION_PROVIDER_H_
+#include <string>
#include "chrome/browser/automation/automation_provider.h"
class TestAutomationResourceMessageFilter;
@@ -47,6 +48,8 @@ class TestAutomationProvider
TestAutomationProviderDelegate* delegate);
protected:
+ virtual std::string GetProtocolVersion();
+
int tab_handle_;
TestAutomationProviderDelegate* delegate_;