OLD | NEW |
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_AUTOMATION_CLIENT_MOCK_H_ | 4 #ifndef CHROME_FRAME_TEST_AUTOMATION_CLIENT_MOCK_H_ |
5 #define CHROME_FRAME_AUTOMATION_CLIENT_MOCK_H_ | 5 #define CHROME_FRAME_TEST_AUTOMATION_CLIENT_MOCK_H_ |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome_frame/chrome_frame_automation.h" | 10 #include "chrome_frame/chrome_frame_automation.h" |
11 #include "chrome_frame/test/chrome_frame_test_utils.h" | 11 #include "chrome_frame/test/chrome_frame_test_utils.h" |
12 #include "chrome_frame/test/proxy_factory_mock.h" | 12 #include "chrome_frame/test/proxy_factory_mock.h" |
13 #include "gmock/gmock.h" | 13 #include "gmock/gmock.h" |
14 | 14 |
15 // ChromeFrameAutomationClient [CFAC] tests. | 15 // ChromeFrameAutomationClient [CFAC] tests. |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 MockProxyFactory factory_; | 130 MockProxyFactory factory_; |
131 MockCFDelegate cfd_; | 131 MockCFDelegate cfd_; |
132 chrome_frame_test::TimedMsgLoop loop_; | 132 chrome_frame_test::TimedMsgLoop loop_; |
133 MockAutomationProxy proxy_; | 133 MockAutomationProxy proxy_; |
134 scoped_ptr<AutomationHandleTracker> tracker_; | 134 scoped_ptr<AutomationHandleTracker> tracker_; |
135 MockAutomationMessageSender dummy_sender_; | 135 MockAutomationMessageSender dummy_sender_; |
136 scoped_refptr<TabProxy> tab_; | 136 scoped_refptr<TabProxy> tab_; |
137 // the victim of all tests | 137 // the victim of all tests |
138 scoped_refptr<ChromeFrameAutomationClient> client_; | 138 scoped_refptr<ChromeFrameAutomationClient> client_; |
139 | 139 |
140 std::wstring profile_; | 140 FilePath profile_path_; |
141 int timeout_; | 141 int timeout_; |
142 void* id_; // Automation server id we are going to return | 142 void* id_; // Automation server id we are going to return |
143 int tab_handle_; // Tab handle. Any non-zero value is Ok. | 143 int tab_handle_; // Tab handle. Any non-zero value is Ok. |
144 | 144 |
145 inline ChromeFrameAutomationProxy* get_proxy() { | 145 inline ChromeFrameAutomationProxy* get_proxy() { |
146 return static_cast<ChromeFrameAutomationProxy*>(&proxy_); | 146 return static_cast<ChromeFrameAutomationProxy*>(&proxy_); |
147 } | 147 } |
148 | 148 |
149 inline void CreateTab() { | 149 inline void CreateTab() { |
150 ASSERT_EQ(NULL, tab_.get()); | 150 ASSERT_EQ(NULL, tab_.get()); |
151 tab_ = new TabProxy(&dummy_sender_, tracker_.get(), tab_handle_); | 151 tab_ = new TabProxy(&dummy_sender_, tracker_.get(), tab_handle_); |
152 } | 152 } |
153 | 153 |
154 // Easy methods to set expectations. | 154 // Easy methods to set expectations. |
155 void SetAutomationServerOk(); | 155 void SetAutomationServerOk(); |
156 void Set_CFD_LaunchFailed(AutomationLaunchResult result); | 156 void Set_CFD_LaunchFailed(AutomationLaunchResult result); |
157 | 157 |
158 protected: | 158 protected: |
159 CFACMockTest() : tracker_(NULL), timeout_(500), | 159 CFACMockTest() |
160 profile_(L"Adam.N.Epilinter") { | 160 : tracker_(NULL), timeout_(500), |
| 161 profile_path_( |
| 162 chrome_frame_test::GetProfilePath(L"Adam.N.Epilinter")) { |
161 id_ = reinterpret_cast<void*>(5); | 163 id_ = reinterpret_cast<void*>(5); |
162 tab_handle_ = 3; | 164 tab_handle_ = 3; |
163 } | 165 } |
164 | 166 |
165 virtual void SetUp() { | 167 virtual void SetUp() { |
166 dummy_sender_.ForwardTo(&proxy_); | 168 dummy_sender_.ForwardTo(&proxy_); |
167 tracker_.reset(new AutomationHandleTracker()); | 169 tracker_.reset(new AutomationHandleTracker()); |
168 | 170 |
169 client_ = new ChromeFrameAutomationClient; | 171 client_ = new ChromeFrameAutomationClient; |
170 client_->set_proxy_factory(&factory_); | 172 client_->set_proxy_factory(&factory_); |
171 } | 173 } |
172 }; | 174 }; |
173 | 175 |
174 | 176 |
175 #endif // CHROME_FRAME_AUTOMATION_CLIENT_MOCK_H_ | 177 #endif // CHROME_FRAME_TEST_AUTOMATION_CLIENT_MOCK_H_ |
176 | 178 |
OLD | NEW |