| 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 "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome_frame/chrome_frame_automation.h" | 12 #include "chrome_frame/chrome_frame_automation.h" |
| 13 #include "chrome_frame/chrome_frame_plugin.h" | 13 #include "chrome_frame/chrome_frame_plugin.h" |
| 14 #include "chrome_frame/navigation_constraints.h" |
| 14 #include "chrome_frame/test/http_server.h" | 15 #include "chrome_frame/test/http_server.h" |
| 15 #include "chrome_frame/test/chrome_frame_test_utils.h" | 16 #include "chrome_frame/test/chrome_frame_test_utils.h" |
| 16 #include "chrome_frame/test/test_with_web_server.h" | 17 #include "chrome_frame/test/test_with_web_server.h" |
| 17 #include "chrome_frame/utils.h" | 18 #include "chrome_frame/utils.h" |
| 18 | 19 |
| 19 template <typename T> | 20 template <typename T> |
| 20 class AutomationMockDelegate | 21 class AutomationMockDelegate |
| 21 : public CWindowImpl<T>, | 22 : public CWindowImpl<T>, |
| 22 public ChromeFramePlugin<T> { | 23 public ChromeFramePlugin<T> { |
| 23 public: | 24 public: |
| (...skipping 27 matching lines...) Expand all Loading... |
| 51 if (automation_client_.get()) { | 52 if (automation_client_.get()) { |
| 52 automation_client_->Uninitialize(); | 53 automation_client_->Uninitialize(); |
| 53 automation_client_ = NULL; | 54 automation_client_ = NULL; |
| 54 } | 55 } |
| 55 if (IsWindow()) | 56 if (IsWindow()) |
| 56 DestroyWindow(); | 57 DestroyWindow(); |
| 57 } | 58 } |
| 58 | 59 |
| 59 // Navigate external tab to the specified url through automation | 60 // Navigate external tab to the specified url through automation |
| 60 bool Navigate(const std::string& url) { | 61 bool Navigate(const std::string& url) { |
| 62 NavigationConstraintsImpl navigation_constraints; |
| 61 url_ = GURL(url); | 63 url_ = GURL(url); |
| 62 bool result = automation_client_->InitiateNavigation(url, | 64 bool result = automation_client_->InitiateNavigation( |
| 63 std::string(), | 65 url, std::string(), &navigation_constraints); |
| 64 false); | |
| 65 if (!result) | 66 if (!result) |
| 66 OnLoadFailed(0, url); | 67 OnLoadFailed(0, url); |
| 67 return result; | 68 return result; |
| 68 } | 69 } |
| 69 | 70 |
| 70 // Navigate the external to a 'file://' url for unit test files | 71 // Navigate the external to a 'file://' url for unit test files |
| 71 bool NavigateRelativeFile(const std::wstring& file) { | 72 bool NavigateRelativeFile(const std::wstring& file) { |
| 72 FilePath cf_source_path; | 73 FilePath cf_source_path; |
| 73 PathService::Get(base::DIR_SOURCE_ROOT, &cf_source_path); | 74 PathService::Get(base::DIR_SOURCE_ROOT, &cf_source_path); |
| 74 std::wstring file_url(L"file://"); | 75 std::wstring file_url(L"file://"); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 virtual void OnLoad(int tab_handle, const GURL& url) { | 228 virtual void OnLoad(int tab_handle, const GURL& url) { |
| 228 Base::OnLoad(tab_handle, url); | 229 Base::OnLoad(tab_handle, url); |
| 229 } | 230 } |
| 230 private: | 231 private: |
| 231 bool request_start_result_; | 232 bool request_start_result_; |
| 232 }; | 233 }; |
| 233 | 234 |
| 234 | 235 |
| 235 #endif // CHROME_FRAME_TEST_CHROME_FRAME_AUTOMATION_MOCK_H_ | 236 #endif // CHROME_FRAME_TEST_CHROME_FRAME_AUTOMATION_MOCK_H_ |
| 236 | 237 |
| OLD | NEW |