Commit 9a23d3ed authored by Sorin Jianu's avatar Sorin Jianu Committed by Commit Bot

Enable IntegrationTest.COMRegistration test.

The test failed on the Win7 Debug CI bot because the
COM apartment of the code making COM calls in the
unit test was not initialized.

COM apartment initialization must be done per-process or
at least, per thread. It is unwise to do it per-function.

Bug: 1149213
Change-Id: I4ef5ae6396bbb101da3f6dfdccf070e54ae26983
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2543122Reviewed-by: default avatarS. Ganesh <ganesh@chromium.org>
Commit-Queue: Sorin Jianu <sorin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827985}
parent 3dd08d6f
...@@ -5,9 +5,21 @@ ...@@ -5,9 +5,21 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/test/launcher/unit_test_launcher.h" #include "base/test/launcher/unit_test_launcher.h"
#include "base/test/test_suite.h" #include "base/test/test_suite.h"
#include "build/build_config.h"
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
#if defined(OS_WIN)
#include <memory>
#include "base/win/scoped_com_initializer.h"
#endif
int main(int argc, char** argv) { int main(int argc, char** argv) {
#if defined(OS_WIN)
auto scoped_com_initializer =
std::make_unique<base::win::ScopedCOMInitializer>(
base::win::ScopedCOMInitializer::kMTA);
#endif
base::TestSuite test_suite(argc, argv); base::TestSuite test_suite(argc, argv);
chrome::RegisterPathProvider(); chrome::RegisterPathProvider();
return base::LaunchUnitTestsSerially( return base::LaunchUnitTestsSerially(
......
...@@ -257,8 +257,7 @@ TEST_F(IntegrationTest, UnregisterUnownedApp) { ...@@ -257,8 +257,7 @@ TEST_F(IntegrationTest, UnregisterUnownedApp) {
// Tests the COM registration after the install. For now, tests that the // Tests the COM registration after the install. For now, tests that the
// COM interfaces are registered, which is indirectly testing the type // COM interfaces are registered, which is indirectly testing the type
// library separation for the public, private, and legacy interfaces. // library separation for the public, private, and legacy interfaces.
// Disabled because of https://crbug.com/1149213 TEST_F(IntegrationTest, COMRegistration) {
TEST_F(IntegrationTest, DISABLED_COMRegistration) {
Install(); Install();
ExpectInterfacesRegistered(); ExpectInterfacesRegistered();
Uninstall(); Uninstall();
......
...@@ -14,15 +14,11 @@ ...@@ -14,15 +14,11 @@
#include "chrome/updater/win/util.h" #include "chrome/updater/win/util.h"
int main(int argc, char** argv) { int main(int argc, char** argv) {
// ScopedCOMInitializer keeps COM initialized in a specific scope. We don't
// want to initialize it for sandboxed processes, so manage its lifetime with
// a unique_ptr, which will call ScopedCOMInitializer's destructor when it
// goes out of scope below.
auto scoped_com_initializer = auto scoped_com_initializer =
std::make_unique<base::win::ScopedCOMInitializer>( std::make_unique<base::win::ScopedCOMInitializer>(
base::win::ScopedCOMInitializer::kMTA); base::win::ScopedCOMInitializer::kMTA);
bool success = updater::InitializeCOMSecurity(); bool success = updater::InitializeCOMSecurity();
DCHECK(success) << "InitializeCOMSecurity() failed."; CHECK(success) << "InitializeCOMSecurity() failed.";
// Some tests will fail if two tests try to launch test_process.exe // Some tests will fail if two tests try to launch test_process.exe
// simultaneously, so run the tests serially. This will still shard them and // simultaneously, so run the tests serially. This will still shard them and
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment