summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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();