Home | History | Annotate | Download | only in test
      1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 #ifndef CHROME_FRAME_TEST_PROXY_FACTORY_MOCK_H_
      5 #define CHROME_FRAME_TEST_PROXY_FACTORY_MOCK_H_
      6 
      7 #include <windows.h>
      8 #include <string>
      9 
     10 #include "gmock/gmock.h"
     11 #include "chrome_frame/chrome_frame_automation.h"
     12 
     13 struct LaunchDelegateMock : public LaunchDelegate {
     14   MOCK_METHOD2(LaunchComplete, void(ChromeFrameAutomationProxy*,
     15       AutomationLaunchResult));
     16   MOCK_METHOD0(AutomationServerDied, void());
     17 };
     18 
     19 class MockProxyFactory : public ProxyFactory {
     20  public:
     21   MOCK_METHOD3(GetAutomationServer,
     22       void (LaunchDelegate*,  // NOLINT
     23             ChromeFrameLaunchParams* params,
     24             void** automation_server_id));
     25   MOCK_METHOD2(ReleaseAutomationServer, bool(void* server_id,
     26                                              LaunchDelegate* delegate));
     27 
     28   MockProxyFactory() : thread_("mock factory worker") {
     29     thread_.Start();
     30     loop_ = thread_.message_loop();
     31   }
     32 
     33   // Fake implementation
     34   void GetServerImpl(ChromeFrameAutomationProxy* pxy,
     35                      void* proxy_id,
     36                      AutomationLaunchResult result,
     37                      LaunchDelegate* d,
     38                      ChromeFrameLaunchParams* params,
     39                      void** automation_server_id);
     40 
     41   base::Thread thread_;
     42   base::MessageLoop* loop_;
     43 };
     44 
     45 #endif  // CHROME_FRAME_TEST_PROXY_FACTORY_MOCK_H_
     46 
     47