| OLD | NEW |
| 1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2010 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 #ifndef CHROME_FRAME_PROXY_FACTORY_MOCK_H_ | 4 #ifndef CHROME_FRAME_TEST_PROXY_FACTORY_MOCK_H_ |
| 5 #define CHROME_FRAME_PROXY_FACTORY_MOCK_H_ | 5 #define CHROME_FRAME_TEST_PROXY_FACTORY_MOCK_H_ |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "gmock/gmock.h" | 10 #include "gmock/gmock.h" |
| 11 #include "chrome_frame/chrome_frame_automation.h" | 11 #include "chrome_frame/chrome_frame_automation.h" |
| 12 | 12 |
| 13 struct LaunchDelegateMock : public ProxyFactory::LaunchDelegate { | 13 struct LaunchDelegateMock : public LaunchDelegate { |
| 14 MOCK_METHOD2(LaunchComplete, void(ChromeFrameAutomationProxy*, | 14 MOCK_METHOD2(LaunchComplete, void(ChromeFrameAutomationProxy*, |
| 15 AutomationLaunchResult)); | 15 AutomationLaunchResult)); |
| 16 MOCK_METHOD0(AutomationServerDied, void()); |
| 16 }; | 17 }; |
| 17 | 18 |
| 18 class MockProxyFactory : public ProxyFactory { | 19 class MockProxyFactory : public ProxyFactory { |
| 19 public: | 20 public: |
| 20 MOCK_METHOD3(GetAutomationServer, void (ProxyFactory::LaunchDelegate*, | 21 MOCK_METHOD3(GetAutomationServer, |
| 21 const ChromeFrameLaunchParams& params, void** automation_server_id)); | 22 void (LaunchDelegate*, // NOLINT |
| 22 MOCK_METHOD1(ReleaseAutomationServer, bool(void* id)); | 23 ChromeFrameLaunchParams* params, |
| 24 void** automation_server_id)); |
| 25 MOCK_METHOD2(ReleaseAutomationServer, bool(void* server_id, |
| 26 LaunchDelegate* delegate)); |
| 23 | 27 |
| 24 MockProxyFactory() : thread_("mock factory worker") { | 28 MockProxyFactory() : thread_("mock factory worker") { |
| 25 thread_.Start(); | 29 thread_.Start(); |
| 26 loop_ = thread_.message_loop(); | 30 loop_ = thread_.message_loop(); |
| 27 } | 31 } |
| 28 | 32 |
| 29 // Fake implementation | 33 // Fake implementation |
| 30 void GetServerImpl(ChromeFrameAutomationProxy* pxy, | 34 void GetServerImpl(ChromeFrameAutomationProxy* pxy, |
| 31 void* proxy_id, | 35 void* proxy_id, |
| 32 AutomationLaunchResult result, | 36 AutomationLaunchResult result, |
| 33 LaunchDelegate* d, | 37 LaunchDelegate* d, |
| 34 const ChromeFrameLaunchParams& params, | 38 ChromeFrameLaunchParams* params, |
| 35 void** automation_server_id); | 39 void** automation_server_id); |
| 36 | 40 |
| 37 base::Thread thread_; | 41 base::Thread thread_; |
| 38 MessageLoop* loop_; | 42 MessageLoop* loop_; |
| 39 }; | 43 }; |
| 40 | 44 |
| 41 | 45 |
| 42 #endif // CHROME_FRAME_PROXY_FACTORY_MOCK_H_ | 46 #endif // CHROME_FRAME_TEST_PROXY_FACTORY_MOCK_H_ |
| 43 | 47 |
| OLD | NEW |