summaryrefslogtreecommitdiffstats
path: root/chrome_frame
diff options
context:
space:
mode:
authorrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-14 21:56:37 +0000
committerrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-14 21:56:37 +0000
commit6f86621928e403beb900107366a1a54125e58aeb (patch)
tree17a05c5238e70f887035ddb8bf37777e131c7362 /chrome_frame
parentc398d0ffbbb088cb3e30c0bcef257aad911a4a79 (diff)
downloadchromium_src-6f86621928e403beb900107366a1a54125e58aeb.zip
chromium_src-6f86621928e403beb900107366a1a54125e58aeb.tar.gz
chromium_src-6f86621928e403beb900107366a1a54125e58aeb.tar.bz2
Fix COM initialization in chrome_frame_tests.exe for the ATL version included in VS2010.
Fix ATL assert that happens when COM is not correctly initialized. Remove spurious HungCOMCallDetector logging messages. BUG=114609 TEST=chrome_frame_tests.exe Review URL: http://codereview.chromium.org/9348086 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121948 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r--chrome_frame/test/chrome_frame_test_utils.h19
-rw-r--r--chrome_frame/test/mock_ie_event_sink_test.cc6
-rw-r--r--chrome_frame/test/run_all_unittests.cc7
3 files changed, 23 insertions, 9 deletions
diff --git a/chrome_frame/test/chrome_frame_test_utils.h b/chrome_frame/test/chrome_frame_test_utils.h
index 518958ac..da01ab5 100644
--- a/chrome_frame/test/chrome_frame_test_utils.h
+++ b/chrome_frame/test/chrome_frame_test_utils.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -79,11 +79,10 @@ class HungCOMCallDetector
public:
HungCOMCallDetector()
: is_hung_(false) {
- LOG(INFO) << __FUNCTION__;
}
~HungCOMCallDetector() {
- LOG(INFO) << __FUNCTION__;
+ TearDown();
}
BEGIN_MSG_MAP(HungCOMCallDetector)
@@ -110,10 +109,16 @@ class HungCOMCallDetector
}
void TearDown() {
- base::win::ScopedComPtr<IMessageFilter> prev_filter;
- CoRegisterMessageFilter(prev_filter_.get(), prev_filter.Receive());
- DestroyWindow();
- m_hWnd = NULL;
+ if (prev_filter_) {
+ base::win::ScopedComPtr<IMessageFilter> prev_filter;
+ CoRegisterMessageFilter(prev_filter_.get(), prev_filter.Receive());
+ DCHECK(prev_filter.IsSameObject(this));
+ prev_filter_.Release();
+ }
+ if (IsWindow()) {
+ DestroyWindow();
+ m_hWnd = NULL;
+ }
}
STDMETHOD_(DWORD, HandleInComingCall)(DWORD call_type,
diff --git a/chrome_frame/test/mock_ie_event_sink_test.cc b/chrome_frame/test/mock_ie_event_sink_test.cc
index 9d90bf9..c31bb62 100644
--- a/chrome_frame/test/mock_ie_event_sink_test.cc
+++ b/chrome_frame/test/mock_ie_event_sink_test.cc
@@ -215,8 +215,10 @@ void MockIEEventSinkTest::LaunchIENavigateAndLoop(const std::wstring& url,
loop_.RunFor(timeout);
}
- IEEventSink::SetAbnormalShutdown(hung_call_detector_->is_hung());
- hung_call_detector_->TearDown();
+ if (hung_call_detector_) {
+ IEEventSink::SetAbnormalShutdown(hung_call_detector_->is_hung());
+ hung_call_detector_->TearDown();
+ }
}
FilePath MockIEEventSinkTest::GetTestFilePath(
diff --git a/chrome_frame/test/run_all_unittests.cc b/chrome_frame/test/run_all_unittests.cc
index 6a1aa1b..de66ba1 100644
--- a/chrome_frame/test/run_all_unittests.cc
+++ b/chrome_frame/test/run_all_unittests.cc
@@ -8,6 +8,7 @@
#include "base/process_util.h"
#include "base/test/test_suite.h"
#include "base/threading/platform_thread.h"
+#include "base/win/scoped_com_initializer.h"
#include "chrome/common/chrome_paths.h"
#include "chrome_frame/crash_server_init.h"
#include "chrome_frame/test/chrome_frame_test_utils.h"
@@ -20,6 +21,11 @@ class ChromeFrameUnittestsModule
: public CAtlExeModuleT<ChromeFrameUnittestsModule> {
public:
static HRESULT InitializeCom() {
+ // Note that this only gets called in versions of ATL included in
+ // VS2008 and earlier. We still need it however since this gets called
+ // at static initialization time, before the ScopedCOMInitializer in main()
+ // and the default implementation of InitializeCom CoInitializes into the
+ // MTA.
return CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
}
};
@@ -34,6 +40,7 @@ void PureCall() {
}
int main(int argc, char **argv) {
+ base::win::ScopedCOMInitializer com_initializer;
ScopedChromeFrameRegistrar::RegisterAndExitProcessIfDirected();
base::EnableTerminationOnHeapCorruption();
base::PlatformThread::SetName("ChromeFrame tests");