summaryrefslogtreecommitdiffstats
path: root/chrome_frame/test/ie_event_sink.cc
diff options
context:
space:
mode:
authorkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-02 22:02:09 +0000
committerkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-02 22:02:09 +0000
commit59aa617b508b067ddaf5c3190c08ee86751d1906 (patch)
treec9cc6c7e2e6ba28dd6661c7b20d07fc2783b211d /chrome_frame/test/ie_event_sink.cc
parent08483ec43f8706d39d77e6797ba8d36227ca1f06 (diff)
downloadchromium_src-59aa617b508b067ddaf5c3190c08ee86751d1906.zip
chromium_src-59aa617b508b067ddaf5c3190c08ee86751d1906.tar.gz
chromium_src-59aa617b508b067ddaf5c3190c08ee86751d1906.tar.bz2
Remove WebBrowserEventSink from chrome frame code, which necessitated some refactor/cleanup in the chrome frame reliability tests.
BUG=none TEST=none Review URL: http://codereview.chromium.org/3304004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58412 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/test/ie_event_sink.cc')
-rw-r--r--chrome_frame/test/ie_event_sink.cc23
1 files changed, 14 insertions, 9 deletions
diff --git a/chrome_frame/test/ie_event_sink.cc b/chrome_frame/test/ie_event_sink.cc
index 7da31dc..0e5ddcb 100644
--- a/chrome_frame/test/ie_event_sink.cc
+++ b/chrome_frame/test/ie_event_sink.cc
@@ -100,10 +100,19 @@ void IEEventSink::Attach(IDispatch* browser_disp) {
EXPECT_TRUE(NULL != browser_disp);
if (browser_disp) {
EXPECT_HRESULT_SUCCEEDED(web_browser2_.QueryFrom(browser_disp));
- EXPECT_TRUE(S_OK == DispEventAdvise(web_browser2_,
- &DIID_DWebBrowserEvents2));
+ EXPECT_HRESULT_SUCCEEDED(Attach(web_browser2_.get()));
+ }
+}
+
+HRESULT IEEventSink::Attach(IWebBrowser2* browser) {
+ DCHECK(browser);
+ HRESULT result;
+ if (browser) {
+ web_browser2_ = browser;
FindIEProcessId();
+ result = DispEventAdvise(web_browser2_, &DIID_DWebBrowserEvents2);
}
+ return result;
}
void IEEventSink::Uninitialize() {
@@ -339,16 +348,11 @@ HRESULT IEEventSink::LaunchIEAndNavigate(
const std::wstring& navigate_url, IEEventListener* listener) {
listener_ = listener;
HRESULT hr = LaunchIEAsComServer(web_browser2_.Receive());
- EXPECT_EQ(S_OK, hr);
- if (hr == S_OK) {
- FindIEProcessId();
+ if (SUCCEEDED(hr)) {
web_browser2_->put_Visible(VARIANT_TRUE);
- hr = DispEventAdvise(web_browser2_, &DIID_DWebBrowserEvents2);
- EXPECT_TRUE(hr == S_OK);
+ Attach(web_browser2_);
hr = Navigate(navigate_url);
}
-
- DLOG_IF(WARNING, FAILED(hr)) << "Failed to launch IE. Error:" << hr;
return hr;
}
@@ -425,6 +429,7 @@ void IEEventSink::FindIEProcessId() {
EXPECT_TRUE(::IsWindow(hwnd));
if (::IsWindow(hwnd))
::GetWindowThreadProcessId(hwnd, &ie_process_id_);
+ EXPECT_NE(static_cast<DWORD>(0), ie_process_id_);
}
// Event callbacks