OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // Executor COM implementation unit tests. | 5 // Executor COM implementation unit tests. |
6 | 6 |
7 #include "ceee/ie/plugin/bho/executor.h" | 7 #include "ceee/ie/plugin/bho/executor.h" |
8 | 8 |
9 #include <shlobj.h> | 9 #include <shlobj.h> |
10 #include <atlbase.h> | 10 #include <atlbase.h> |
| 11 |
11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
12 #include "base/file_path.h" | 13 #include "base/file_path.h" |
13 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
14 #include "base/path_service.h" | 15 #include "base/path_service.h" |
15 #include "base/process_util.h" | 16 #include "base/process_util.h" |
16 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
17 #include "base/win/registry.h" | 18 #include "base/win/registry.h" |
| 19 #include "base/win/scoped_handle.h" |
18 #include "base/win/windows_version.h" | 20 #include "base/win/windows_version.h" |
19 #include "ceee/common/initializing_coclass.h" | 21 #include "ceee/common/initializing_coclass.h" |
20 #include "ceee/ie/plugin/toolband/toolband_proxy.h" | 22 #include "ceee/ie/plugin/toolband/toolband_proxy.h" |
21 #include "ceee/ie/testing/mock_broker_and_friends.h" | 23 #include "ceee/ie/testing/mock_broker_and_friends.h" |
22 #include "ceee/testing/utils/instance_count_mixin.h" | 24 #include "ceee/testing/utils/instance_count_mixin.h" |
23 #include "gmock/gmock.h" | 25 #include "gmock/gmock.h" |
24 #include "gtest/gtest.h" | 26 #include "gtest/gtest.h" |
25 | 27 |
26 namespace { | 28 namespace { |
27 | 29 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 154 |
153 // Marshal the object in the thread. | 155 // Marshal the object in the thread. |
154 RunSync( | 156 RunSync( |
155 NewRunnableMethod(this, &RemoteObjectHost::InitRemoteThread, object)); | 157 NewRunnableMethod(this, &RemoteObjectHost::InitRemoteThread, object)); |
156 | 158 |
157 // Marshal the contained object back as an IUnknown. | 159 // Marshal the contained object back as an IUnknown. |
158 ASSERT_HRESULT_SUCCEEDED(remote_git_ptr_.CopyTo(&remote_object_)); | 160 ASSERT_HRESULT_SUCCEEDED(remote_git_ptr_.CopyTo(&remote_object_)); |
159 } | 161 } |
160 | 162 |
161 void RunSync(Task* task) { | 163 void RunSync(Task* task) { |
162 ScopedHandle event(::CreateEvent(NULL, TRUE, FALSE, NULL)); | 164 base::win::ScopedHandle event(::CreateEvent(NULL, TRUE, FALSE, NULL)); |
163 | 165 |
164 remote_thread_.message_loop()->PostTask(FROM_HERE, task); | 166 remote_thread_.message_loop()->PostTask(FROM_HERE, task); |
165 remote_thread_.message_loop()->PostTask(FROM_HERE, | 167 remote_thread_.message_loop()->PostTask(FROM_HERE, |
166 NewRunnableFunction(::SetEvent, event.Get())); | 168 NewRunnableFunction(::SetEvent, event.Get())); |
167 | 169 |
168 ASSERT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(event.Get(), INFINITE)); | 170 ASSERT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(event.Get(), INFINITE)); |
169 } | 171 } |
170 | 172 |
171 void InitRemoteThread(IUnknown* object) { | 173 void InitRemoteThread(IUnknown* object) { |
172 EXPECT_HRESULT_SUCCEEDED(::CoInitialize(NULL)); | 174 EXPECT_HRESULT_SUCCEEDED(::CoInitialize(NULL)); |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 .WillOnce( | 755 .WillOnce( |
754 DoAll( | 756 DoAll( |
755 QuitMessageLoop(&loop_), | 757 QuitMessageLoop(&loop_), |
756 Return(E_CAFEBABE))); | 758 Return(E_CAFEBABE))); |
757 } | 759 } |
758 | 760 |
759 loop_.Run(); | 761 loop_.Run(); |
760 } | 762 } |
761 | 763 |
762 } // namespace | 764 } // namespace |
OLD | NEW |