summaryrefslogtreecommitdiffstats
path: root/chrome_frame/test
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-07 18:27:52 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-07 18:27:52 +0000
commitd8b83b219eb3df6cf86e4842d7ffec8b946d46b8 (patch)
treee1a033e1144ae2c0d505dc1a06f59650fa8e678f /chrome_frame/test
parent139fe522a7eb4f85dc77e67821bcc45806c48c0c (diff)
downloadchromium_src-d8b83b219eb3df6cf86e4842d7ffec8b946d46b8.zip
chromium_src-d8b83b219eb3df6cf86e4842d7ffec8b946d46b8.tar.gz
chromium_src-d8b83b219eb3df6cf86e4842d7ffec8b946d46b8.tar.bz2
The ChromeFrame net tests would not work on IE6 and IE7. This is because the profile path used varies across these browsers.
This changed in the recent fixes for privacy where on IE6 and IE7 the profile is in temporary internet files. The ChromeFrame net tests assumed the profile would always be in the default path which caused the tests to not work. Added a helper function in chrome_Frame_test_utils.cc/.h to retrieve the correct profile path based on IE version and use this. This should get the net tests up and running on the FYI IE6 builder. Review URL: http://codereview.chromium.org/1553015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43856 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/test')
-rw-r--r--chrome_frame/test/chrome_frame_test_utils.cc21
-rw-r--r--chrome_frame/test/chrome_frame_test_utils.h6
-rw-r--r--chrome_frame/test/net/fake_external_tab.cc15
-rw-r--r--chrome_frame/test/net/fake_external_tab.h3
4 files changed, 29 insertions, 16 deletions
diff --git a/chrome_frame/test/chrome_frame_test_utils.cc b/chrome_frame/test/chrome_frame_test_utils.cc
index 9c82b20..a96ef8d 100644
--- a/chrome_frame/test/chrome_frame_test_utils.cc
+++ b/chrome_frame/test/chrome_frame_test_utils.cc
@@ -9,6 +9,7 @@
#include <iepmapi.h>
#include <sddl.h>
+#include "base/file_version_info.h"
#include "base/file_util.h"
#include "base/message_loop.h"
#include "base/path_service.h"
@@ -34,6 +35,7 @@ const wchar_t kFirefoxImageName[] = L"firefox.exe";
const wchar_t kOperaImageName[] = L"opera.exe";
const wchar_t kSafariImageName[] = L"safari.exe";
const wchar_t kChromeImageName[] = L"chrome.exe";
+const wchar_t kIEProfileName[] = L"iexplore";
// Callback function for EnumThreadWindows.
BOOL CALLBACK CloseWindowsThreadCallback(HWND hwnd, LPARAM param) {
@@ -768,4 +770,23 @@ void WebBrowserEventSink::StopWatching() {
window_watcher_.RemoveObserver(this);
}
+FilePath GetProfilePathForIE() {
+ FilePath profile_path;
+ // Browsers without IDeleteBrowsingHistory in non-priv mode
+ // have their profiles moved into "Temporary Internet Files".
+ // The code below basically retrieves the version of IE and computes
+ // the profile directory accordingly.
+ std::wstring path = chrome_frame_test::GetExecutableAppPath(kIEImageName);
+ scoped_ptr<FileVersionInfo> ie_version_info(
+ FileVersionInfo::CreateFileVersionInfo(FilePath(path)));
+ std::wstring ie_version = ie_version_info->product_version();
+ if (ie_version[0] == L'8') {
+ profile_path = GetProfilePath(kIEProfileName);
+ } else {
+ profile_path = GetIETemporaryFilesFolder();
+ profile_path = profile_path.Append(L"Google Chrome Frame");
+ }
+ return profile_path;
+}
+
} // namespace chrome_frame_test
diff --git a/chrome_frame/test/chrome_frame_test_utils.h b/chrome_frame/test/chrome_frame_test_utils.h
index 9040d9a..ebb3ff7 100644
--- a/chrome_frame/test/chrome_frame_test_utils.h
+++ b/chrome_frame/test/chrome_frame_test_utils.h
@@ -319,6 +319,12 @@ END_SINK_MAP()
WindowWatchdog window_watcher_;
};
+// Returns the path of the exe passed in.
+std::wstring GetExecutableAppPath(const std::wstring& file);
+
+// Returns the profile path to be used for IE. This varies as per version.
+FilePath GetProfilePathForIE();
+
} // namespace chrome_frame_test
#endif // CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_
diff --git a/chrome_frame/test/net/fake_external_tab.cc b/chrome_frame/test/net/fake_external_tab.cc
index 8db3b48..497ae88 100644
--- a/chrome_frame/test/net/fake_external_tab.cc
+++ b/chrome_frame/test/net/fake_external_tab.cc
@@ -12,6 +12,7 @@
#include "base/command_line.h"
#include "base/file_util.h"
+#include "base/file_version_info.h"
#include "base/i18n/icu_util.h"
#include "base/path_service.h"
#include "base/scoped_bstr_win.h"
@@ -164,10 +165,9 @@ BOOL SupplyProxyCredentials::EnumChildren(HWND hwnd, LPARAM param) {
return TRUE;
}
-
FakeExternalTab::FakeExternalTab() {
+ user_data_dir_ = chrome_frame_test::GetProfilePathForIE();
PathService::Get(chrome::DIR_USER_DATA, &overridden_user_dir_);
- GetProfilePath(&user_data_dir_);
PathService::Override(chrome::DIR_USER_DATA, user_data_dir_);
process_singleton_.reset(new ProcessSingleton(user_data_dir_));
}
@@ -178,17 +178,6 @@ FakeExternalTab::~FakeExternalTab() {
}
}
-std::wstring FakeExternalTab::GetProfileName() {
- return L"iexplore";
-}
-
-bool FakeExternalTab::GetProfilePath(FilePath* path) {
- if (!chrome::GetChromeFrameUserDataDirectory(path))
- return false;
- *path = path->Append(GetProfileName());
- return true;
-}
-
void FakeExternalTab::Initialize() {
DCHECK(g_browser_process == NULL);
SystemMonitor system_monitor;
diff --git a/chrome_frame/test/net/fake_external_tab.h b/chrome_frame/test/net/fake_external_tab.h
index dd35756..5238277 100644
--- a/chrome_frame/test/net/fake_external_tab.h
+++ b/chrome_frame/test/net/fake_external_tab.h
@@ -26,9 +26,6 @@ class FakeExternalTab {
FakeExternalTab();
virtual ~FakeExternalTab();
- virtual std::wstring GetProfileName();
-
- virtual bool GetProfilePath(FilePath* path);
virtual void Initialize();
virtual void Shutdown();