OLD | NEW |
1 // Copyright (c) 2011 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 #ifndef CHROME_FRAME_TEST_AUTOMATION_CLIENT_MOCK_H_ | 5 #ifndef CHROME_FRAME_TEST_AUTOMATION_CLIENT_MOCK_H_ |
6 #define CHROME_FRAME_TEST_AUTOMATION_CLIENT_MOCK_H_ | 6 #define CHROME_FRAME_TEST_AUTOMATION_CLIENT_MOCK_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "chrome_frame/chrome_frame_automation.h" | 12 #include "chrome_frame/chrome_frame_automation.h" |
13 #include "chrome_frame/test/chrome_frame_test_utils.h" | 13 #include "chrome_frame/test/chrome_frame_test_utils.h" |
14 #include "chrome_frame/test/proxy_factory_mock.h" | 14 #include "chrome_frame/test/proxy_factory_mock.h" |
| 15 #include "chrome_frame/utils.h" |
15 #include "gmock/gmock.h" | 16 #include "gmock/gmock.h" |
16 | 17 |
17 using testing::StrictMock; | 18 using testing::StrictMock; |
18 | 19 |
19 // ChromeFrameAutomationClient [CFAC] tests. | 20 // ChromeFrameAutomationClient [CFAC] tests. |
20 struct MockCFDelegate : public ChromeFrameDelegateImpl { | 21 struct MockCFDelegate : public ChromeFrameDelegateImpl { |
21 MOCK_CONST_METHOD0(GetWindow, WindowType()); | 22 MOCK_CONST_METHOD0(GetWindow, WindowType()); |
22 MOCK_METHOD1(GetBounds, void(RECT* bounds)); | 23 MOCK_METHOD1(GetBounds, void(RECT* bounds)); |
23 MOCK_METHOD0(GetDocumentUrl, std::string()); | 24 MOCK_METHOD0(GetDocumentUrl, std::string()); |
24 MOCK_METHOD2(ExecuteScript, bool(const std::string& script, | 25 MOCK_METHOD2(ExecuteScript, bool(const std::string& script, |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 tab_ = new TabProxy(&dummy_sender_, tracker_.get(), tab_handle_); | 163 tab_ = new TabProxy(&dummy_sender_, tracker_.get(), tab_handle_); |
163 } | 164 } |
164 | 165 |
165 // Easy methods to set expectations. | 166 // Easy methods to set expectations. |
166 void SetAutomationServerOk(int times); | 167 void SetAutomationServerOk(int times); |
167 void Set_CFD_LaunchFailed(AutomationLaunchResult result); | 168 void Set_CFD_LaunchFailed(AutomationLaunchResult result); |
168 | 169 |
169 protected: | 170 protected: |
170 CFACMockTest() | 171 CFACMockTest() |
171 : tracker_(NULL), timeout_(500), | 172 : tracker_(NULL), timeout_(500), |
172 returned_proxy_(static_cast<ChromeFrameAutomationProxy*>(&mock_proxy_)), | 173 returned_proxy_(static_cast<ChromeFrameAutomationProxy*>(&mock_proxy_)) { |
173 profile_path_( | 174 GetChromeFrameProfilePath(L"Adam.N.Epilinter", &profile_path_); |
174 chrome_frame_test::GetProfilePath(L"Adam.N.Epilinter")) { | |
175 id_ = reinterpret_cast<void*>(5); | 175 id_ = reinterpret_cast<void*>(5); |
176 tab_handle_ = 3; | 176 tab_handle_ = 3; |
177 } | 177 } |
178 | 178 |
179 virtual void SetUp() { | 179 virtual void SetUp() { |
180 dummy_sender_.ForwardTo(&mock_proxy_); | 180 dummy_sender_.ForwardTo(&mock_proxy_); |
181 tracker_.reset(new AutomationHandleTracker()); | 181 tracker_.reset(new AutomationHandleTracker()); |
182 | 182 |
183 client_ = new ChromeFrameAutomationClient; | 183 client_ = new ChromeFrameAutomationClient; |
184 client_->set_proxy_factory(&factory_); | 184 client_->set_proxy_factory(&factory_); |
185 } | 185 } |
186 }; | 186 }; |
187 | 187 |
188 #endif // CHROME_FRAME_TEST_AUTOMATION_CLIENT_MOCK_H_ | 188 #endif // CHROME_FRAME_TEST_AUTOMATION_CLIENT_MOCK_H_ |
OLD | NEW |