Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: chrome_frame/test/chrome_frame_automation_mock.h

Issue 890005: Add a command line flag to disable infobars. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome_frame/test/automation_client_mock.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome_frame/test/chrome_frame_test_utils.h" 14 #include "chrome_frame/test/chrome_frame_test_utils.h"
15 #include "chrome_frame/utils.h" 15 #include "chrome_frame/utils.h"
16 16
17 template <typename T> 17 template <typename T>
18 class AutomationMockDelegate 18 class AutomationMockDelegate
19 : public CWindowImpl<T>, 19 : public CWindowImpl<T>,
20 public ChromeFramePlugin<T> { 20 public ChromeFramePlugin<T> {
21 public: 21 public:
22 AutomationMockDelegate(MessageLoop* caller_message_loop, 22 AutomationMockDelegate(MessageLoop* caller_message_loop,
23 int launch_timeout, bool perform_version_check, 23 int launch_timeout, bool perform_version_check,
24 const std::wstring& profile_name, 24 const std::wstring& profile_name,
25 const std::wstring& extra_chrome_arguments, bool incognito) 25 const std::wstring& extra_chrome_arguments, bool incognito,
26 bool is_widget_mode)
26 : caller_message_loop_(caller_message_loop), is_connected_(false), 27 : caller_message_loop_(caller_message_loop), is_connected_(false),
27 navigation_result_(false) { 28 navigation_result_(false) {
28 test_server_.SetUp(); 29 test_server_.SetUp();
29 30
30 FilePath profile_path( 31 FilePath profile_path(
31 chrome_frame_test::GetProfilePath(profile_name)); 32 chrome_frame_test::GetProfilePath(profile_name));
32 33
33 automation_client_ = new ChromeFrameAutomationClient; 34 automation_client_ = new ChromeFrameAutomationClient;
34 automation_client_->Initialize(this, launch_timeout, perform_version_check, 35 ChromeFrameLaunchParams clp = {
35 profile_path, extra_chrome_arguments, incognito); 36 launch_timeout,
37 GURL(),
38 GURL(),
39 profile_path,
40 profile_name,
41 extra_chrome_arguments,
42 perform_version_check,
43 incognito,
44 is_widget_mode
45 };
46 automation_client_->Initialize(this, clp);
36 } 47 }
37 ~AutomationMockDelegate() { 48 ~AutomationMockDelegate() {
38 if (automation_client_.get()) { 49 if (automation_client_.get()) {
39 automation_client_->Uninitialize(); 50 automation_client_->Uninitialize();
40 automation_client_ = NULL; 51 automation_client_ = NULL;
41 } 52 }
42 if (IsWindow()) 53 if (IsWindow())
43 DestroyWindow(); 54 DestroyWindow();
44 55
45 test_server_.TearDown(); 56 test_server_.TearDown();
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 bool is_connected_; 140 bool is_connected_;
130 bool navigation_result_; 141 bool navigation_result_;
131 }; 142 };
132 143
133 class AutomationMockLaunch 144 class AutomationMockLaunch
134 : public AutomationMockDelegate<AutomationMockLaunch> { 145 : public AutomationMockDelegate<AutomationMockLaunch> {
135 public: 146 public:
136 typedef AutomationMockDelegate<AutomationMockLaunch> Base; 147 typedef AutomationMockDelegate<AutomationMockLaunch> Base;
137 AutomationMockLaunch(MessageLoop* caller_message_loop, 148 AutomationMockLaunch(MessageLoop* caller_message_loop,
138 int launch_timeout) 149 int launch_timeout)
139 : Base(caller_message_loop, launch_timeout, true, L"", L"", false) { 150 : Base(caller_message_loop, launch_timeout, true, L"", L"", false,
151 false) {
140 } 152 }
141 virtual void OnAutomationServerReady() { 153 virtual void OnAutomationServerReady() {
142 Base::OnAutomationServerReady(); 154 Base::OnAutomationServerReady();
143 QuitMessageLoop(); 155 QuitMessageLoop();
144 } 156 }
145 bool launch_result() const { 157 bool launch_result() const {
146 return is_connected(); 158 return is_connected();
147 } 159 }
148 }; 160 };
149 161
150 class AutomationMockNavigate 162 class AutomationMockNavigate
151 : public AutomationMockDelegate<AutomationMockNavigate> { 163 : public AutomationMockDelegate<AutomationMockNavigate> {
152 public: 164 public:
153 typedef AutomationMockDelegate<AutomationMockNavigate> Base; 165 typedef AutomationMockDelegate<AutomationMockNavigate> Base;
154 AutomationMockNavigate(MessageLoop* caller_message_loop, 166 AutomationMockNavigate(MessageLoop* caller_message_loop,
155 int launch_timeout) 167 int launch_timeout)
156 : Base(caller_message_loop, launch_timeout, true, L"", L"", false) { 168 : Base(caller_message_loop, launch_timeout, true, L"", L"", false,
169 false) {
157 } 170 }
158 virtual void OnLoad(int tab_handle, const GURL& url) { 171 virtual void OnLoad(int tab_handle, const GURL& url) {
159 Base::OnLoad(tab_handle, url); 172 Base::OnLoad(tab_handle, url);
160 QuitMessageLoop(); 173 QuitMessageLoop();
161 } 174 }
162 }; 175 };
163 176
164 class AutomationMockPostMessage 177 class AutomationMockPostMessage
165 : public AutomationMockDelegate<AutomationMockPostMessage> { 178 : public AutomationMockDelegate<AutomationMockPostMessage> {
166 public: 179 public:
167 typedef AutomationMockDelegate<AutomationMockPostMessage> Base; 180 typedef AutomationMockDelegate<AutomationMockPostMessage> Base;
168 AutomationMockPostMessage(MessageLoop* caller_message_loop, 181 AutomationMockPostMessage(MessageLoop* caller_message_loop,
169 int launch_timeout) 182 int launch_timeout)
170 : Base(caller_message_loop, launch_timeout, true, L"", L"", false), 183 : Base(caller_message_loop, launch_timeout, true, L"", L"", false, false),
171 postmessage_result_(false) {} 184 postmessage_result_(false) {}
172 bool postmessage_result() const { 185 bool postmessage_result() const {
173 return postmessage_result_; 186 return postmessage_result_;
174 } 187 }
175 virtual void OnLoad(int tab_handle, const GURL& url) { 188 virtual void OnLoad(int tab_handle, const GURL& url) {
176 Base::OnLoad(tab_handle, url); 189 Base::OnLoad(tab_handle, url);
177 if (navigation_result()) { 190 if (navigation_result()) {
178 automation()->ForwardMessageFromExternalHost("Test", "null", "*"); 191 automation()->ForwardMessageFromExternalHost("Test", "null", "*");
179 } 192 }
180 } 193 }
181 virtual void OnMessageFromChromeFrame(int tab_handle, 194 virtual void OnMessageFromChromeFrame(int tab_handle,
182 const std::string& message, 195 const std::string& message,
183 const std::string& origin, 196 const std::string& origin,
184 const std::string& target) { 197 const std::string& target) {
185 postmessage_result_ = true; 198 postmessage_result_ = true;
186 QuitMessageLoop(); 199 QuitMessageLoop();
187 } 200 }
188 private: 201 private:
189 bool postmessage_result_; 202 bool postmessage_result_;
190 }; 203 };
191 204
192 class AutomationMockHostNetworkRequestStart 205 class AutomationMockHostNetworkRequestStart
193 : public AutomationMockDelegate<AutomationMockHostNetworkRequestStart> { 206 : public AutomationMockDelegate<AutomationMockHostNetworkRequestStart> {
194 public: 207 public:
195 typedef AutomationMockDelegate<AutomationMockHostNetworkRequestStart> Base; 208 typedef AutomationMockDelegate<AutomationMockHostNetworkRequestStart> Base;
196 AutomationMockHostNetworkRequestStart(MessageLoop* caller_message_loop, 209 AutomationMockHostNetworkRequestStart(MessageLoop* caller_message_loop,
197 int launch_timeout) 210 int launch_timeout)
198 : Base(caller_message_loop, launch_timeout, true, L"", L"", false), 211 : Base(caller_message_loop, launch_timeout, true, L"", L"", false, false),
199 request_start_result_(false) { 212 request_start_result_(false) {
200 if (automation()) { 213 if (automation()) {
201 automation()->set_use_chrome_network(false); 214 automation()->set_use_chrome_network(false);
202 } 215 }
203 } 216 }
204 bool request_start_result() const { 217 bool request_start_result() const {
205 return request_start_result_; 218 return request_start_result_;
206 } 219 }
207 virtual void OnRequestStart(int tab_handle, int request_id, 220 virtual void OnRequestStart(int tab_handle, int request_id,
208 const IPC::AutomationURLRequest& request) { 221 const IPC::AutomationURLRequest& request) {
209 request_start_result_ = true; 222 request_start_result_ = true;
210 QuitMessageLoop(); 223 QuitMessageLoop();
211 } 224 }
212 virtual void OnLoad(int tab_handle, const GURL& url) { 225 virtual void OnLoad(int tab_handle, const GURL& url) {
213 Base::OnLoad(tab_handle, url); 226 Base::OnLoad(tab_handle, url);
214 } 227 }
215 private: 228 private:
216 bool request_start_result_; 229 bool request_start_result_;
217 }; 230 };
218 231
219 232
220 #endif // CHROME_FRAME_TEST_CHROME_FRAME_AUTOMATION_MOCK_H_ 233 #endif // CHROME_FRAME_TEST_CHROME_FRAME_AUTOMATION_MOCK_H_
221 234
OLDNEW
« no previous file with comments | « chrome_frame/test/automation_client_mock.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698