diff options
-rw-r--r-- | chrome_frame/chrome_frame.gyp | 6 | ||||
-rw-r--r-- | chrome_frame/test/chrome_frame_test_utils.cc | 32 | ||||
-rw-r--r-- | chrome_frame/test/chrome_frame_test_utils.h | 7 | ||||
-rw-r--r-- | chrome_frame/test/http_negotiate_unittest.cc | 5 |
4 files changed, 45 insertions, 5 deletions
diff --git a/chrome_frame/chrome_frame.gyp b/chrome_frame/chrome_frame.gyp index d067b0d..245bd3f 100644 --- a/chrome_frame/chrome_frame.gyp +++ b/chrome_frame/chrome_frame.gyp @@ -139,12 +139,18 @@ 'chrome_frame_unittest_main.cc', 'chrome_launcher_unittest.cc', 'function_stub_unittest.cc', + 'test/chrome_frame_test_utils.h', + 'test/chrome_frame_test_utils.cc', 'test/com_message_event_unittest.cc', 'test/html_util_unittests.cc', 'test/http_negotiate_unittest.cc', + 'test/simulate_input.h', + 'test/simulate_input.cc', 'test/urlmon_moniker_tests.h', 'test/urlmon_moniker_unittest.cc', 'test/util_unittests.cc', + 'test/window_watchdog.h', + 'test/window_watchdog.cc', 'unittest_precompile.h', 'unittest_precompile.cc', 'urlmon_upload_data_stream.cc', diff --git a/chrome_frame/test/chrome_frame_test_utils.cc b/chrome_frame/test/chrome_frame_test_utils.cc index e8d3889..8e985c0 100644 --- a/chrome_frame/test/chrome_frame_test_utils.cc +++ b/chrome_frame/test/chrome_frame_test_utils.cc @@ -734,6 +734,8 @@ HRESULT WebBrowserEventSink::CloseWebBrowser() { DCHECK(process_id_to_wait_for_ == 0); if (!web_browser2_) return E_FAIL; + + DisconnectFromChromeFrame(); web_browser2_->Quit(); return S_OK; } @@ -782,17 +784,37 @@ void WebBrowserEventSink::StopWatching() { window_watcher_.RemoveObserver(this); } +std::wstring GetExeVersion(const std::wstring& exe_path) { + scoped_ptr<FileVersionInfo> ie_version_info( + FileVersionInfo::CreateFileVersionInfo(FilePath(exe_path))); + return ie_version_info->product_version(); +} + +IEVersion GetInstalledIEVersion() { + std::wstring path = chrome_frame_test::GetExecutableAppPath(kIEImageName); + std::wstring version = GetExeVersion(path); + + switch (version[0]) { + case '6': + return IE_6; + case '7': + return IE_7; + case '8': + return IE_8; + default: + break; + } + + return IE_UNSUPPORTED; +} + 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') { + if (GetInstalledIEVersion() == IE_8) { profile_path = GetProfilePath(kIEProfileName); } else { profile_path = GetIETemporaryFilesFolder(); diff --git a/chrome_frame/test/chrome_frame_test_utils.h b/chrome_frame/test/chrome_frame_test_utils.h index a3d032c..b7a3908 100644 --- a/chrome_frame/test/chrome_frame_test_utils.h +++ b/chrome_frame/test/chrome_frame_test_utils.h @@ -24,6 +24,7 @@ #include "chrome_frame/test_utils.h" #include "chrome_frame/test/simulate_input.h" #include "chrome_frame/test/window_watchdog.h" +#include "chrome_frame/utils.h" // Include without path to make GYP build see it. #include "chrome_tab.h" // NOLINT @@ -326,6 +327,12 @@ std::wstring GetExecutableAppPath(const std::wstring& file); // Returns the profile path to be used for IE. This varies as per version. FilePath GetProfilePathForIE(); +// Returns the version of the exe passed in. +std::wstring GetExeVersion(const std::wstring& exe_path); + +// Returns the version of Internet Explorer on the machine. +IEVersion GetInstalledIEVersion(); + } // namespace chrome_frame_test #endif // CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_ diff --git a/chrome_frame/test/http_negotiate_unittest.cc b/chrome_frame/test/http_negotiate_unittest.cc index a8d2228..b203f61 100644 --- a/chrome_frame/test/http_negotiate_unittest.cc +++ b/chrome_frame/test/http_negotiate_unittest.cc @@ -10,6 +10,7 @@ #include "base/string_util.h" #include "chrome_frame/http_negotiate.h" #include "chrome_frame/html_utils.h" +#include "chrome_frame/test/chrome_frame_test_utils.h" #include "chrome_frame/utils.h" #include "gtest/gtest.h" #include "gmock/gmock.h" @@ -183,6 +184,10 @@ END_COM_MAP() }; TEST_F(HttpNegotiateTest, ReportProgress) { + if (chrome_frame_test::GetInstalledIEVersion() == IE_6) { + DLOG(INFO) << "Not running test for IE6"; + return; + } static const int kReportProgressIndex = 4; CComObjectStackEx<TestInternetProtocolSink> test_sink; IInternetProtocolSink_ReportProgress_Fn original = |