| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <memory> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
| 15 #include "base/task_runner.h" | 15 #include "base/task_runner.h" |
| 16 #include "base/threading/simple_thread.h" | 16 #include "base/threading/simple_thread.h" |
| 17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
| 18 #include "ppapi/c/pp_instance.h" | 18 #include "ppapi/c/pp_instance.h" |
| 19 #include "ppapi/proxy/host_dispatcher.h" | 19 #include "ppapi/proxy/host_dispatcher.h" |
| 20 #include "ppapi/proxy/plugin_dispatcher.h" | 20 #include "ppapi/proxy/plugin_dispatcher.h" |
| 21 #include "ppapi/proxy/plugin_globals.h" | 21 #include "ppapi/proxy/plugin_globals.h" |
| 22 #include "ppapi/proxy/plugin_proxy_delegate.h" | 22 #include "ppapi/proxy/plugin_proxy_delegate.h" |
| 23 #include "ppapi/proxy/plugin_resource_tracker.h" | 23 #include "ppapi/proxy/plugin_resource_tracker.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 IPC::Sender* browser_sender_; | 170 IPC::Sender* browser_sender_; |
| 171 | 171 |
| 172 DISALLOW_COPY_AND_ASSIGN(PluginDelegateMock); | 172 DISALLOW_COPY_AND_ASSIGN(PluginDelegateMock); |
| 173 }; | 173 }; |
| 174 | 174 |
| 175 private: | 175 private: |
| 176 void CreatePluginGlobals( | 176 void CreatePluginGlobals( |
| 177 const scoped_refptr<base::TaskRunner>& ipc_task_runner); | 177 const scoped_refptr<base::TaskRunner>& ipc_task_runner); |
| 178 | 178 |
| 179 GlobalsConfiguration globals_config_; | 179 GlobalsConfiguration globals_config_; |
| 180 scoped_ptr<PluginGlobals> plugin_globals_; | 180 std::unique_ptr<PluginGlobals> plugin_globals_; |
| 181 | 181 |
| 182 scoped_ptr<PluginDispatcher> plugin_dispatcher_; | 182 std::unique_ptr<PluginDispatcher> plugin_dispatcher_; |
| 183 PluginDelegateMock plugin_delegate_mock_; | 183 PluginDelegateMock plugin_delegate_mock_; |
| 184 }; | 184 }; |
| 185 | 185 |
| 186 class PluginProxyTest : public PluginProxyTestHarness, public testing::Test { | 186 class PluginProxyTest : public PluginProxyTestHarness, public testing::Test { |
| 187 public: | 187 public: |
| 188 PluginProxyTest(); | 188 PluginProxyTest(); |
| 189 virtual ~PluginProxyTest(); | 189 virtual ~PluginProxyTest(); |
| 190 | 190 |
| 191 // testing::Test implementation. | 191 // testing::Test implementation. |
| 192 virtual void SetUp(); | 192 virtual void SetUp(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 | 233 |
| 234 private: | 234 private: |
| 235 // base::DelegateSimpleThread::Delegate implementation. | 235 // base::DelegateSimpleThread::Delegate implementation. |
| 236 void Run() override; | 236 void Run() override; |
| 237 | 237 |
| 238 void QuitNestedLoop(); | 238 void QuitNestedLoop(); |
| 239 | 239 |
| 240 static void InternalSetUpTestOnSecondaryThread(void* user_data, | 240 static void InternalSetUpTestOnSecondaryThread(void* user_data, |
| 241 int32_t result); | 241 int32_t result); |
| 242 | 242 |
| 243 scoped_ptr<base::DelegateSimpleThread> secondary_thread_; | 243 std::unique_ptr<base::DelegateSimpleThread> secondary_thread_; |
| 244 scoped_ptr<base::RunLoop> nested_main_thread_message_loop_; | 244 std::unique_ptr<base::RunLoop> nested_main_thread_message_loop_; |
| 245 }; | 245 }; |
| 246 | 246 |
| 247 class HostProxyTestHarness : public ProxyTestHarnessBase { | 247 class HostProxyTestHarness : public ProxyTestHarnessBase { |
| 248 public: | 248 public: |
| 249 explicit HostProxyTestHarness(GlobalsConfiguration globals_config); | 249 explicit HostProxyTestHarness(GlobalsConfiguration globals_config); |
| 250 virtual ~HostProxyTestHarness(); | 250 virtual ~HostProxyTestHarness(); |
| 251 | 251 |
| 252 HostDispatcher* host_dispatcher() { return host_dispatcher_.get(); } | 252 HostDispatcher* host_dispatcher() { return host_dispatcher_.get(); } |
| 253 ResourceTracker& resource_tracker() { | 253 ResourceTracker& resource_tracker() { |
| 254 return *host_globals_->GetResourceTracker(); | 254 return *host_globals_->GetResourceTracker(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 base::SingleThreadTaskRunner* ipc_task_runner_; // Weak | 294 base::SingleThreadTaskRunner* ipc_task_runner_; // Weak |
| 295 base::WaitableEvent* shutdown_event_; // Weak | 295 base::WaitableEvent* shutdown_event_; // Weak |
| 296 | 296 |
| 297 DISALLOW_COPY_AND_ASSIGN(DelegateMock); | 297 DISALLOW_COPY_AND_ASSIGN(DelegateMock); |
| 298 }; | 298 }; |
| 299 | 299 |
| 300 private: | 300 private: |
| 301 void CreateHostGlobals(); | 301 void CreateHostGlobals(); |
| 302 | 302 |
| 303 GlobalsConfiguration globals_config_; | 303 GlobalsConfiguration globals_config_; |
| 304 scoped_ptr<ppapi::TestGlobals> host_globals_; | 304 std::unique_ptr<ppapi::TestGlobals> host_globals_; |
| 305 scoped_ptr<HostDispatcher> host_dispatcher_; | 305 std::unique_ptr<HostDispatcher> host_dispatcher_; |
| 306 // The host side of the real proxy doesn't lock, so this disables locking for | 306 // The host side of the real proxy doesn't lock, so this disables locking for |
| 307 // the thread the host side of the test runs on. | 307 // the thread the host side of the test runs on. |
| 308 scoped_ptr<ProxyLock::LockingDisablerForTest> disable_locking_; | 308 std::unique_ptr<ProxyLock::LockingDisablerForTest> disable_locking_; |
| 309 DelegateMock delegate_mock_; | 309 DelegateMock delegate_mock_; |
| 310 }; | 310 }; |
| 311 | 311 |
| 312 class HostProxyTest : public HostProxyTestHarness, public testing::Test { | 312 class HostProxyTest : public HostProxyTestHarness, public testing::Test { |
| 313 public: | 313 public: |
| 314 HostProxyTest(); | 314 HostProxyTest(); |
| 315 virtual ~HostProxyTest(); | 315 virtual ~HostProxyTest(); |
| 316 | 316 |
| 317 // testing::Test implementation. | 317 // testing::Test implementation. |
| 318 virtual void SetUp(); | 318 virtual void SetUp(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 // EXPECT_VAR_IS_STRING("foo", my_var); | 375 // EXPECT_VAR_IS_STRING("foo", my_var); |
| 376 #define EXPECT_VAR_IS_STRING(str, var) { \ | 376 #define EXPECT_VAR_IS_STRING(str, var) { \ |
| 377 StringVar* sv = StringVar::FromPPVar(var); \ | 377 StringVar* sv = StringVar::FromPPVar(var); \ |
| 378 EXPECT_TRUE(sv); \ | 378 EXPECT_TRUE(sv); \ |
| 379 if (sv) \ | 379 if (sv) \ |
| 380 EXPECT_EQ(str, sv->value()); \ | 380 EXPECT_EQ(str, sv->value()); \ |
| 381 } | 381 } |
| 382 | 382 |
| 383 } // namespace proxy | 383 } // namespace proxy |
| 384 } // namespace ppapi | 384 } // namespace ppapi |
| OLD | NEW |