OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_FRAME_TEST_AUTOMATION_CLIENT_MOCK_H_ | |
6 #define CHROME_FRAME_TEST_AUTOMATION_CLIENT_MOCK_H_ | |
7 | |
8 #include <windows.h> | |
9 #include <string> | |
10 | |
11 #include "base/strings/string_util.h" | |
12 #include "chrome_frame/chrome_frame_automation.h" | |
13 #include "chrome_frame/test/chrome_frame_test_utils.h" | |
14 #include "chrome_frame/test/proxy_factory_mock.h" | |
15 #include "chrome_frame/utils.h" | |
16 #include "gmock/gmock.h" | |
17 | |
18 using testing::StrictMock; | |
19 | |
20 class MockAutomationProxy : public ChromeFrameAutomationProxy { | |
21 public: | |
22 MOCK_METHOD1(Send, bool(IPC::Message*)); | |
23 MOCK_METHOD3(SendAsAsync, | |
24 void(IPC::SyncMessage* msg, | |
25 SyncMessageReplyDispatcher::SyncMessageCallContext* context, | |
26 void* key)); | |
27 MOCK_METHOD1(CancelAsync, void(void* key)); | |
28 MOCK_METHOD1(CreateTabProxy, scoped_refptr<TabProxy>(int handle)); | |
29 MOCK_METHOD1(ReleaseTabProxy, void(AutomationHandle handle)); | |
30 MOCK_METHOD0(server_version, std::string(void)); | |
31 | |
32 ~MockAutomationProxy() {} | |
33 }; | |
34 | |
35 struct MockAutomationMessageSender : public AutomationMessageSender { | |
36 virtual bool Send(IPC::Message* msg) { | |
37 return proxy_->Send(msg); | |
38 } | |
39 | |
40 virtual bool Send(IPC::Message* msg, int timeout_ms) { | |
41 return proxy_->Send(msg); | |
42 } | |
43 | |
44 void ForwardTo(StrictMock<MockAutomationProxy> *p) { | |
45 proxy_ = p; | |
46 } | |
47 | |
48 StrictMock<MockAutomationProxy>* proxy_; | |
49 }; | |
50 | |
51 #endif // CHROME_FRAME_TEST_AUTOMATION_CLIENT_MOCK_H_ | |
OLD | NEW |