| 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" |
| 11 #include "chrome_frame/chrome_frame_automation.h" | 11 #include "chrome_frame/chrome_frame_automation.h" |
| 12 #include "chrome_frame/chrome_frame_plugin.h" | 12 #include "chrome_frame/chrome_frame_plugin.h" |
| 13 #include "chrome_frame/test/http_server.h" | 13 #include "chrome_frame/test/http_server.h" |
| 14 | 14 |
| 15 template <typename T> | 15 template <typename T> |
| 16 class AutomationMockDelegate | 16 class AutomationMockDelegate |
| 17 : public CWindowImpl<T>, | 17 : public CWindowImpl<T>, |
| 18 public ChromeFramePlugin<T> { | 18 public ChromeFramePlugin<T> { |
| 19 public: | 19 public: |
| 20 AutomationMockDelegate(MessageLoop* caller_message_loop, | 20 AutomationMockDelegate(MessageLoop* caller_message_loop, |
| 21 int launch_timeout, bool perform_version_check, | 21 int launch_timeout, bool perform_version_check, |
| 22 const std::wstring& profile_name, | 22 const std::wstring& profile_name, |
| 23 const std::wstring& extra_chrome_arguments, bool incognito) | 23 const std::wstring& extra_chrome_arguments, bool incognito) |
| 24 : caller_message_loop_(caller_message_loop), is_connected_(false) { | 24 : caller_message_loop_(caller_message_loop), is_connected_(false) { |
| 25 test_server_.SetUp(); | 25 test_server_.SetUp(); |
| 26 automation_client_.reset(new ChromeFrameAutomationClient); | 26 automation_client_ = new ChromeFrameAutomationClient; |
| 27 automation_client_->Initialize(this, launch_timeout, perform_version_check, | 27 automation_client_->Initialize(this, launch_timeout, perform_version_check, |
| 28 profile_name, extra_chrome_arguments, incognito); | 28 profile_name, extra_chrome_arguments, incognito); |
| 29 } | 29 } |
| 30 ~AutomationMockDelegate() { | 30 ~AutomationMockDelegate() { |
| 31 if (automation_client_.get()) { | 31 if (automation_client_.get()) { |
| 32 automation_client_->Uninitialize(); | 32 automation_client_->Uninitialize(); |
| 33 automation_client_.reset(); | 33 automation_client_ = NULL; |
| 34 } | 34 } |
| 35 if (IsWindow()) | 35 if (IsWindow()) |
| 36 DestroyWindow(); | 36 DestroyWindow(); |
| 37 | 37 |
| 38 test_server_.TearDown(); | 38 test_server_.TearDown(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 // Navigate external tab to the specified url through automation | 41 // Navigate external tab to the specified url through automation |
| 42 bool Navigate(const std::string& url) { | 42 bool Navigate(const std::string& url) { |
| 43 url_ = GURL(url); | 43 url_ = GURL(url); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 virtual void OnLoad(int tab_handle, const GURL& url) { | 199 virtual void OnLoad(int tab_handle, const GURL& url) { |
| 200 Base::OnLoad(tab_handle, url); | 200 Base::OnLoad(tab_handle, url); |
| 201 } | 201 } |
| 202 private: | 202 private: |
| 203 bool request_start_result_; | 203 bool request_start_result_; |
| 204 }; | 204 }; |
| 205 | 205 |
| 206 | 206 |
| 207 #endif // CHROME_FRAME_TEST_CHROME_FRAME_AUTOMATION_MOCK_H_ | 207 #endif // CHROME_FRAME_TEST_CHROME_FRAME_AUTOMATION_MOCK_H_ |
| 208 | 208 |
| OLD | NEW |