summaryrefslogtreecommitdiffstats
path: root/remoting/base/auto_thread_unittest.cc
diff options
context:
space:
mode:
authorjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-27 08:20:49 +0000
committerjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-27 08:20:49 +0000
commit8ff5726166f19eef46af3d2e5026607a41cca681 (patch)
treeb42ea2badb57e337cf44e264356dde17290664c8 /remoting/base/auto_thread_unittest.cc
parent2d92cfe31b1bf40f0b1b9985500e4e557d710f50 (diff)
downloadchromium_src-8ff5726166f19eef46af3d2e5026607a41cca681.zip
chromium_src-8ff5726166f19eef46af3d2e5026607a41cca681.tar.gz
chromium_src-8ff5726166f19eef46af3d2e5026607a41cca681.tar.bz2
Revert 169595 - Add AutoThread types for Windows that initialize COM.
This CL adds AutoThread types that create a UI MessageLoop on the thread and initialize COM for single- or multi-threaded used. BUG=145856 Review URL: https://chromiumcodereview.appspot.com/11348087 Speculative revert to fix deterministic failures in remoting_unittests that are without log output; they were introduced by one of three changes, and this is the only one that touches remoting. TBR=wez@chromium.org Review URL: https://codereview.chromium.org/11299194 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169604 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/base/auto_thread_unittest.cc')
-rw-r--r--remoting/base/auto_thread_unittest.cc65
1 files changed, 1 insertions, 64 deletions
diff --git a/remoting/base/auto_thread_unittest.cc b/remoting/base/auto_thread_unittest.cc
index 35dd3a5..65f4aa5 100644
--- a/remoting/base/auto_thread_unittest.cc
+++ b/remoting/base/auto_thread_unittest.cc
@@ -7,11 +7,6 @@
#include "remoting/base/auto_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
-#if defined(OS_WIN)
-#include <objbase.h>
-#include "base/win/windows_version.h"
-#endif
-
namespace {
const char kThreadName[] = "Test thread";
@@ -27,13 +22,6 @@ void PostSetFlagTask(
task_runner->PostTask(FROM_HERE, base::Bind(&SetFlagTask, success));
}
-#if defined(OS_WIN)
-void CheckComAptTypeTask(APTTYPE* apt_type_out, HRESULT* hresult) {
- APTTYPEQUALIFIER apt_type_qualifier;
- *hresult = CoGetApartmentType(apt_type_out, &apt_type_qualifier);
-}
-#endif
-
} // namespace
namespace remoting {
@@ -71,6 +59,7 @@ class AutoThreadTest : public testing::Test {
message_loop_.PostTask(FROM_HERE, MessageLoop::QuitClosure());
}
+
MessageLoop message_loop_;
bool message_loop_quit_correctly_;
scoped_refptr<AutoThreadTaskRunner> main_task_runner_;
@@ -123,56 +112,4 @@ TEST_F(AutoThreadTest, ThreadDependency) {
EXPECT_TRUE(success);
}
-#if defined(OS_WIN)
-TEST_F(AutoThreadTest, ThreadWithComMta) {
- // CoGetApartmentType requires Windows 7 or above.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
- scoped_refptr<base::TaskRunner> task_runner =
- AutoThread::CreateWithLoopAndComInitTypes(
- kThreadName, main_task_runner_, MessageLoop::TYPE_DEFAULT,
- AutoThread::COM_INIT_MTA);
- EXPECT_TRUE(task_runner.get());
-
- // Post a task to query the COM apartment type.
- HRESULT hresult = E_FAIL;
- APTTYPE apt_type = APTTYPE_NA;
- task_runner->PostTask(FROM_HERE,
- base::Bind(&CheckComAptTypeTask, &apt_type, &hresult));
-
- task_runner = NULL;
- RunMessageLoop();
-
- EXPECT_EQ(S_OK, hresult);
- EXPECT_EQ(APTTYPE_MTA, apt_type);
-}
-
-TEST_F(AutoThreadTest, ThreadWithComSta) {
- // CoGetApartmentType requires Windows 7 or above.
- if (base::win::GetVersion() < base::win::VERSION_WIN7)
- return;
-
- scoped_refptr<base::TaskRunner> task_runner =
- AutoThread::CreateWithLoopAndComInitTypes(
- kThreadName, main_task_runner_, MessageLoop::TYPE_UI,
- AutoThread::COM_INIT_STA);
- EXPECT_TRUE(task_runner.get());
-
- // Post a task to query the COM apartment type.
- HRESULT hresult = E_FAIL;
- APTTYPE apt_type = APTTYPE_NA;
- task_runner->PostTask(FROM_HERE,
- base::Bind(&CheckComAptTypeTask, &apt_type, &hresult));
-
- task_runner = NULL;
- RunMessageLoop();
-
- EXPECT_EQ(S_OK, hresult);
- // Whether the thread is the "main" STA apartment depends upon previous
- // COM activity in this test process, so allow both types here.
- EXPECT_TRUE(apt_type == APTTYPE_MAINSTA || apt_type == APTTYPE_STA);
-}
-#endif // defined(OS_WIN)
-
} // namespace remoting