| OLD | NEW |
| 1 // Copyright (c) 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_TEST_AUTOMATION_CLIENT_MOCK_H_ | 4 #ifndef CHROME_FRAME_AUTOMATION_CLIENT_MOCK_H_ |
| 5 #define CHROME_FRAME_TEST_AUTOMATION_CLIENT_MOCK_H_ | 5 #define CHROME_FRAME_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 FilePath profile_path_; | 140 std::wstring profile_; |
| 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() | 159 CFACMockTest() : tracker_(NULL), timeout_(500), |
| 160 : tracker_(NULL), timeout_(500), | 160 profile_(L"Adam.N.Epilinter") { |
| 161 profile_path_( | |
| 162 chrome_frame_test::GetProfilePath(L"Adam.N.Epilinter")) { | |
| 163 id_ = reinterpret_cast<void*>(5); | 161 id_ = reinterpret_cast<void*>(5); |
| 164 tab_handle_ = 3; | 162 tab_handle_ = 3; |
| 165 } | 163 } |
| 166 | 164 |
| 167 virtual void SetUp() { | 165 virtual void SetUp() { |
| 168 dummy_sender_.ForwardTo(&proxy_); | 166 dummy_sender_.ForwardTo(&proxy_); |
| 169 tracker_.reset(new AutomationHandleTracker()); | 167 tracker_.reset(new AutomationHandleTracker()); |
| 170 | 168 |
| 171 client_ = new ChromeFrameAutomationClient; | 169 client_ = new ChromeFrameAutomationClient; |
| 172 client_->set_proxy_factory(&factory_); | 170 client_->set_proxy_factory(&factory_); |
| 173 } | 171 } |
| 174 }; | 172 }; |
| 175 | 173 |
| 176 | 174 |
| 177 #endif // CHROME_FRAME_TEST_AUTOMATION_CLIENT_MOCK_H_ | 175 #endif // CHROME_FRAME_AUTOMATION_CLIENT_MOCK_H_ |
| 178 | 176 |
| OLD | NEW |