| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 4 |
| 5 // TestWebViewDelegate class: | 5 // TestWebViewDelegate class: |
| 6 // This class implements the WebViewDelegate methods for the test shell. One | 6 // This class implements the WebViewDelegate methods for the test shell. One |
| 7 // instance is owned by each TestShell. | 7 // instance is owned by each TestShell. |
| 8 | 8 |
| 9 #ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ | 9 #ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ |
| 10 #define WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ | 10 #define WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 virtual void didReceiveServerRedirectForProvisionalLoad(WebKit::WebFrame*); | 200 virtual void didReceiveServerRedirectForProvisionalLoad(WebKit::WebFrame*); |
| 201 virtual void didFailProvisionalLoad( | 201 virtual void didFailProvisionalLoad( |
| 202 WebKit::WebFrame*, const WebKit::WebURLError&); | 202 WebKit::WebFrame*, const WebKit::WebURLError&); |
| 203 virtual void didCommitProvisionalLoad( | 203 virtual void didCommitProvisionalLoad( |
| 204 WebKit::WebFrame*, bool is_new_navigation); | 204 WebKit::WebFrame*, bool is_new_navigation); |
| 205 virtual void didReceiveTitle( | 205 virtual void didReceiveTitle( |
| 206 WebKit::WebFrame*, const WebKit::WebString& title, | 206 WebKit::WebFrame*, const WebKit::WebString& title, |
| 207 WebKit::WebTextDirection direction); | 207 WebKit::WebTextDirection direction); |
| 208 virtual void didFinishDocumentLoad(WebKit::WebFrame*); | 208 virtual void didFinishDocumentLoad(WebKit::WebFrame*); |
| 209 virtual void didHandleOnloadEvents(WebKit::WebFrame*); | 209 virtual void didHandleOnloadEvents(WebKit::WebFrame*); |
| 210 virtual void didFailLoad( | |
| 211 WebKit::WebFrame*, const WebKit::WebURLError&); | |
| 212 virtual void didFinishLoad(WebKit::WebFrame*); | 210 virtual void didFinishLoad(WebKit::WebFrame*); |
| 213 virtual void didNavigateWithinPage( | 211 virtual void didNavigateWithinPage( |
| 214 WebKit::WebFrame*, bool is_new_navigation); | 212 WebKit::WebFrame*, bool is_new_navigation); |
| 215 virtual void didChangeLocationWithinPage( | 213 virtual void didChangeLocationWithinPage( |
| 216 WebKit::WebFrame*); | 214 WebKit::WebFrame*); |
| 217 virtual void assignIdentifierToRequest( | 215 virtual void assignIdentifierToRequest( |
| 218 WebKit::WebFrame*, unsigned identifier, const WebKit::WebURLRequest&); | 216 WebKit::WebFrame*, unsigned identifier, const WebKit::WebURLRequest&); |
| 219 virtual void willSendRequest( | 217 virtual void willSendRequest( |
| 220 WebKit::WebFrame*, unsigned identifier, WebKit::WebURLRequest&, | 218 WebKit::WebFrame*, unsigned identifier, WebKit::WebURLRequest&, |
| 221 const WebKit::WebURLResponse& redirectResponse); | 219 const WebKit::WebURLResponse& redirectResponse); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 252 const webkit::npapi::WebPluginGeometry& move) OVERRIDE; | 250 const webkit::npapi::WebPluginGeometry& move) OVERRIDE; |
| 253 virtual void DidStartLoadingForPlugin() OVERRIDE {} | 251 virtual void DidStartLoadingForPlugin() OVERRIDE {} |
| 254 virtual void DidStopLoadingForPlugin() OVERRIDE {} | 252 virtual void DidStopLoadingForPlugin() OVERRIDE {} |
| 255 virtual WebKit::WebCookieJar* GetCookieJar() OVERRIDE; | 253 virtual WebKit::WebCookieJar* GetCookieJar() OVERRIDE; |
| 256 | 254 |
| 257 explicit TestWebViewDelegate(TestShell* shell); | 255 explicit TestWebViewDelegate(TestShell* shell); |
| 258 virtual ~TestWebViewDelegate(); | 256 virtual ~TestWebViewDelegate(); |
| 259 void Reset(); | 257 void Reset(); |
| 260 | 258 |
| 261 // Additional accessors | 259 // Additional accessors |
| 262 WebKit::WebFrame* top_loading_frame() { return top_loading_frame_; } | |
| 263 #if defined(OS_WIN) | 260 #if defined(OS_WIN) |
| 264 IDropTarget* drop_delegate() { return drop_delegate_.get(); } | 261 IDropTarget* drop_delegate() { return drop_delegate_.get(); } |
| 265 #endif | 262 #endif |
| 266 | 263 |
| 267 void set_pending_extra_data(TestShellExtraData* extra_data) { | 264 void set_pending_extra_data(TestShellExtraData* extra_data) { |
| 268 pending_extra_data_.reset(extra_data); | 265 pending_extra_data_.reset(extra_data); |
| 269 } | 266 } |
| 270 | 267 |
| 271 // Methods for modifying WebPreferences | 268 // Methods for modifying WebPreferences |
| 272 void SetUserStyleSheetEnabled(bool is_enabled); | 269 void SetUserStyleSheetEnabled(bool is_enabled); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 | 331 |
| 335 // Called when the URL of the page changes. | 332 // Called when the URL of the page changes. |
| 336 // Should be used to update the text of the URL bar. | 333 // Should be used to update the text of the URL bar. |
| 337 void SetAddressBarURL(const GURL& url); | 334 void SetAddressBarURL(const GURL& url); |
| 338 | 335 |
| 339 // Show a JavaScript alert as a popup message. | 336 // Show a JavaScript alert as a popup message. |
| 340 // The caller should test whether we're in layout test mode and only | 337 // The caller should test whether we're in layout test mode and only |
| 341 // call this function when we really want a message to pop up. | 338 // call this function when we really want a message to pop up. |
| 342 void ShowJavaScriptAlert(const base::string16& message); | 339 void ShowJavaScriptAlert(const base::string16& message); |
| 343 | 340 |
| 344 // In the Mac code, this is called to trigger the end of a test after the | |
| 345 // page has finished loading. From here, we can generate the dump for the | |
| 346 // test. | |
| 347 void LocationChangeDone(WebKit::WebFrame*); | |
| 348 | |
| 349 // Tests that require moving or resizing the main window (via resizeTo() or | 341 // Tests that require moving or resizing the main window (via resizeTo() or |
| 350 // moveTo()) pass in Chrome even though Chrome disregards move requests for | 342 // moveTo()) pass in Chrome even though Chrome disregards move requests for |
| 351 // non-popup windows (see TabContents::RequestMove()). These functions allow | 343 // non-popup windows (see TabContents::RequestMove()). These functions allow |
| 352 // the test shell to mimic its behavior. If setWindowRect() is called for | 344 // the test shell to mimic its behavior. If setWindowRect() is called for |
| 353 // the main window, the passed in WebRect is saved as fake_rect_ and we return | 345 // the main window, the passed in WebRect is saved as fake_rect_ and we return |
| 354 // it instead of the real window dimensions whenever rootWindowRect() is | 346 // it instead of the real window dimensions whenever rootWindowRect() is |
| 355 // called. | 347 // called. |
| 356 WebKit::WebRect fake_window_rect(); | 348 WebKit::WebRect fake_window_rect(); |
| 357 void set_fake_window_rect(const WebKit::WebRect&); | 349 void set_fake_window_rect(const WebKit::WebRect&); |
| 358 | 350 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 374 // Toggles the behavior of the policy delegate. If true, then navigations | 366 // Toggles the behavior of the policy delegate. If true, then navigations |
| 375 // will be allowed. Otherwise, they will be ignored (dropped). | 367 // will be allowed. Otherwise, they will be ignored (dropped). |
| 376 bool policy_delegate_is_permissive_; | 368 bool policy_delegate_is_permissive_; |
| 377 | 369 |
| 378 // If true, the policy delegate will signal layout test completion. | 370 // If true, the policy delegate will signal layout test completion. |
| 379 bool policy_delegate_should_notify_done_; | 371 bool policy_delegate_should_notify_done_; |
| 380 | 372 |
| 381 // Non-owning pointer. The delegate is owned by the host. | 373 // Non-owning pointer. The delegate is owned by the host. |
| 382 TestShell* shell_; | 374 TestShell* shell_; |
| 383 | 375 |
| 384 // This is non-NULL IFF a load is in progress. | |
| 385 WebKit::WebFrame* top_loading_frame_; | |
| 386 | |
| 387 // For tracking session history. See RenderView. | 376 // For tracking session history. See RenderView. |
| 388 int page_id_; | 377 int page_id_; |
| 389 int last_page_id_updated_; | 378 int last_page_id_updated_; |
| 390 | 379 |
| 391 scoped_ptr<TestShellExtraData> pending_extra_data_; | 380 scoped_ptr<TestShellExtraData> pending_extra_data_; |
| 392 | 381 |
| 393 // Maps resource identifiers to a descriptive string. | 382 // Maps resource identifiers to a descriptive string. |
| 394 typedef std::map<uint32, std::string> ResourceMap; | 383 typedef std::map<uint32, std::string> ResourceMap; |
| 395 ResourceMap resource_identifier_map_; | 384 ResourceMap resource_identifier_map_; |
| 396 std::string GetResourceDescription(uint32 identifier); | 385 std::string GetResourceDescription(uint32 identifier); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 std::string edit_command_name_; | 421 std::string edit_command_name_; |
| 433 std::string edit_command_value_; | 422 std::string edit_command_value_; |
| 434 | 423 |
| 435 // The mock spellchecker used in TestWebViewDelegate::spellCheck(). | 424 // The mock spellchecker used in TestWebViewDelegate::spellCheck(). |
| 436 MockSpellCheck mock_spellcheck_; | 425 MockSpellCheck mock_spellcheck_; |
| 437 | 426 |
| 438 DISALLOW_COPY_AND_ASSIGN(TestWebViewDelegate); | 427 DISALLOW_COPY_AND_ASSIGN(TestWebViewDelegate); |
| 439 }; | 428 }; |
| 440 | 429 |
| 441 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ | 430 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ |
| OLD | NEW |