| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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_CHROME_FRAME_AUTOMATION_MOCK_H_ | 4 #ifndef CHROME_FRAME_TEST_CHROME_FRAME_AUTOMATION_MOCK_H_ |
| 5 #define CHROME_FRAME_TEST_CHROME_FRAME_AUTOMATION_MOCK_H_ | 5 #define CHROME_FRAME_TEST_CHROME_FRAME_AUTOMATION_MOCK_H_ |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 is_connected_ = true; | 91 is_connected_ = true; |
| 92 } else { | 92 } else { |
| 93 NOTREACHED(); | 93 NOTREACHED(); |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 virtual void OnAutomationServerLaunchFailed() { | 97 virtual void OnAutomationServerLaunchFailed() { |
| 98 QuitMessageLoop(); | 98 QuitMessageLoop(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 virtual void OnLoad(int tab_handle, const GURL& url) { | 101 virtual void OnLoad(const GURL& url) { |
| 102 if (url_ == url) { | 102 if (url_ == url) { |
| 103 navigation_result_ = true; | 103 navigation_result_ = true; |
| 104 } else { | 104 } else { |
| 105 QuitMessageLoop(); | 105 QuitMessageLoop(); |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 virtual void OnLoadFailed(int error_code, const std::string& url) { | 109 virtual void OnLoadFailed(int error_code, const std::string& url) { |
| 110 navigation_result_ = false; | 110 navigation_result_ = false; |
| 111 QuitMessageLoop(); | 111 QuitMessageLoop(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 class AutomationMockNavigate | 163 class AutomationMockNavigate |
| 164 : public AutomationMockDelegate<AutomationMockNavigate> { | 164 : public AutomationMockDelegate<AutomationMockNavigate> { |
| 165 public: | 165 public: |
| 166 typedef AutomationMockDelegate<AutomationMockNavigate> Base; | 166 typedef AutomationMockDelegate<AutomationMockNavigate> Base; |
| 167 AutomationMockNavigate(MessageLoop* caller_message_loop, | 167 AutomationMockNavigate(MessageLoop* caller_message_loop, |
| 168 int launch_timeout) | 168 int launch_timeout) |
| 169 : Base(caller_message_loop, launch_timeout, true, L"", L"", L"", false, | 169 : Base(caller_message_loop, launch_timeout, true, L"", L"", L"", false, |
| 170 false) { | 170 false) { |
| 171 } | 171 } |
| 172 virtual void OnLoad(int tab_handle, const GURL& url) { | 172 virtual void OnLoad(const GURL& url) { |
| 173 Base::OnLoad(tab_handle, url); | 173 Base::OnLoad(url); |
| 174 QuitMessageLoop(); | 174 QuitMessageLoop(); |
| 175 } | 175 } |
| 176 }; | 176 }; |
| 177 | 177 |
| 178 class AutomationMockPostMessage | 178 class AutomationMockPostMessage |
| 179 : public AutomationMockDelegate<AutomationMockPostMessage> { | 179 : public AutomationMockDelegate<AutomationMockPostMessage> { |
| 180 public: | 180 public: |
| 181 typedef AutomationMockDelegate<AutomationMockPostMessage> Base; | 181 typedef AutomationMockDelegate<AutomationMockPostMessage> Base; |
| 182 AutomationMockPostMessage(MessageLoop* caller_message_loop, | 182 AutomationMockPostMessage(MessageLoop* caller_message_loop, |
| 183 int launch_timeout) | 183 int launch_timeout) |
| 184 : Base(caller_message_loop, launch_timeout, true, L"", L"", L"", false, | 184 : Base(caller_message_loop, launch_timeout, true, L"", L"", L"", false, |
| 185 false), | 185 false), |
| 186 postmessage_result_(false) {} | 186 postmessage_result_(false) {} |
| 187 bool postmessage_result() const { | 187 bool postmessage_result() const { |
| 188 return postmessage_result_; | 188 return postmessage_result_; |
| 189 } | 189 } |
| 190 virtual void OnLoad(int tab_handle, const GURL& url) { | 190 virtual void OnLoad(const GURL& url) { |
| 191 Base::OnLoad(tab_handle, url); | 191 Base::OnLoad(url); |
| 192 if (navigation_result()) { | 192 if (navigation_result()) { |
| 193 automation()->ForwardMessageFromExternalHost("Test", "null", "*"); | 193 automation()->ForwardMessageFromExternalHost("Test", "null", "*"); |
| 194 } | 194 } |
| 195 } | 195 } |
| 196 virtual void OnMessageFromChromeFrame(int tab_handle, | 196 virtual void OnMessageFromChromeFrame(const std::string& message, |
| 197 const std::string& message, | |
| 198 const std::string& origin, | 197 const std::string& origin, |
| 199 const std::string& target) { | 198 const std::string& target) { |
| 200 postmessage_result_ = true; | 199 postmessage_result_ = true; |
| 201 QuitMessageLoop(); | 200 QuitMessageLoop(); |
| 202 } | 201 } |
| 203 private: | 202 private: |
| 204 bool postmessage_result_; | 203 bool postmessage_result_; |
| 205 }; | 204 }; |
| 206 | 205 |
| 207 class AutomationMockHostNetworkRequestStart | 206 class AutomationMockHostNetworkRequestStart |
| 208 : public AutomationMockDelegate<AutomationMockHostNetworkRequestStart> { | 207 : public AutomationMockDelegate<AutomationMockHostNetworkRequestStart> { |
| 209 public: | 208 public: |
| 210 typedef AutomationMockDelegate<AutomationMockHostNetworkRequestStart> Base; | 209 typedef AutomationMockDelegate<AutomationMockHostNetworkRequestStart> Base; |
| 211 AutomationMockHostNetworkRequestStart(MessageLoop* caller_message_loop, | 210 AutomationMockHostNetworkRequestStart(MessageLoop* caller_message_loop, |
| 212 int launch_timeout) | 211 int launch_timeout) |
| 213 : Base(caller_message_loop, launch_timeout, true, L"", L"", L"", false, | 212 : Base(caller_message_loop, launch_timeout, true, L"", L"", L"", false, |
| 214 false), | 213 false), |
| 215 request_start_result_(false) { | 214 request_start_result_(false) { |
| 216 if (automation()) { | 215 if (automation()) { |
| 217 automation()->set_use_chrome_network(false); | 216 automation()->set_use_chrome_network(false); |
| 218 } | 217 } |
| 219 } | 218 } |
| 220 bool request_start_result() const { | 219 bool request_start_result() const { |
| 221 return request_start_result_; | 220 return request_start_result_; |
| 222 } | 221 } |
| 223 virtual void OnRequestStart(int tab_handle, int request_id, | 222 virtual void OnRequestStart(int request_id, |
| 224 const IPC::AutomationURLRequest& request) { | 223 const AutomationURLRequest& request) { |
| 225 request_start_result_ = true; | 224 request_start_result_ = true; |
| 226 QuitMessageLoop(); | 225 QuitMessageLoop(); |
| 227 } | 226 } |
| 228 virtual void OnLoad(int tab_handle, const GURL& url) { | 227 virtual void OnLoad(const GURL& url) { |
| 229 Base::OnLoad(tab_handle, url); | 228 Base::OnLoad(url); |
| 230 } | 229 } |
| 231 private: | 230 private: |
| 232 bool request_start_result_; | 231 bool request_start_result_; |
| 233 }; | 232 }; |
| 234 | 233 |
| 235 | 234 |
| 236 #endif // CHROME_FRAME_TEST_CHROME_FRAME_AUTOMATION_MOCK_H_ | 235 #endif // CHROME_FRAME_TEST_CHROME_FRAME_AUTOMATION_MOCK_H_ |
| 237 | 236 |
| OLD | NEW |