Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_ |
| 11 | 11 |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 | 13 |
| 14 #if defined(OS_WIN) | 14 #if defined(OS_WIN) |
| 15 #include <windows.h> | 15 #include <windows.h> |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 #include <map> | 18 #include <map> |
| 19 | 19 |
| 20 #if defined(OS_LINUX) | 20 #if defined(OS_LINUX) |
| 21 #include <gdk/gdkcursor.h> | 21 #include <gdk/gdkcursor.h> |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 #include "base/basictypes.h" | 24 #include "base/basictypes.h" |
| 25 #include "base/scoped_ptr.h" | 25 #include "base/scoped_ptr.h" |
| 26 #include "base/weak_ptr.h" | 26 #include "base/weak_ptr.h" |
| 27 #include "webkit/api/public/WebFrameClient.h" | 27 #include "webkit/api/public/WebFrameClient.h" |
| 28 #include "webkit/api/public/WebRect.h" | |
| 28 #if defined(OS_MACOSX) | 29 #if defined(OS_MACOSX) |
| 29 #include "webkit/api/public/WebRect.h" | |
| 30 #include "webkit/api/public/WebPopupMenuInfo.h" | 30 #include "webkit/api/public/WebPopupMenuInfo.h" |
| 31 #endif | 31 #endif |
| 32 #include "webkit/glue/webcursor.h" | 32 #include "webkit/glue/webcursor.h" |
| 33 #include "webkit/glue/webplugin_page_delegate.h" | 33 #include "webkit/glue/webplugin_page_delegate.h" |
| 34 #include "webkit/glue/webview_delegate.h" | 34 #include "webkit/glue/webview_delegate.h" |
| 35 #if defined(OS_WIN) | 35 #if defined(OS_WIN) |
| 36 #include "webkit/tools/test_shell/drag_delegate.h" | 36 #include "webkit/tools/test_shell/drag_delegate.h" |
| 37 #include "webkit/tools/test_shell/drop_delegate.h" | 37 #include "webkit/tools/test_shell/drop_delegate.h" |
| 38 #endif | 38 #endif |
| 39 #include "webkit/tools/test_shell/test_navigation_controller.h" | 39 #include "webkit/tools/test_shell/test_navigation_controller.h" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 // Show a JavaScript alert as a popup message. | 299 // Show a JavaScript alert as a popup message. |
| 300 // The caller should test whether we're in layout test mode and only | 300 // The caller should test whether we're in layout test mode and only |
| 301 // call this function when we really want a message to pop up. | 301 // call this function when we really want a message to pop up. |
| 302 void ShowJavaScriptAlert(const std::wstring& message); | 302 void ShowJavaScriptAlert(const std::wstring& message); |
| 303 | 303 |
| 304 // In the Mac code, this is called to trigger the end of a test after the | 304 // In the Mac code, this is called to trigger the end of a test after the |
| 305 // page has finished loading. From here, we can generate the dump for the | 305 // page has finished loading. From here, we can generate the dump for the |
| 306 // test. | 306 // test. |
| 307 void LocationChangeDone(WebKit::WebFrame*); | 307 void LocationChangeDone(WebKit::WebFrame*); |
| 308 | 308 |
| 309 // Tests that require moving or resizing the main window (via resizeTo() or | |
| 310 // moveTo()) pass in Chrome even though Chrome disregards move requests for | |
| 311 // non-popup windows (see TabContents::RequestMove()). These functions allow | |
| 312 // the test shell to mimic its behavior. If setWindowRect() is called for | |
| 313 // the main window, the passed inWebRect is saved as fake_rect_ and we return | |
|
dglazkov
2009/09/23 18:17:14
... passed in WebRect ...
| |
| 314 // it instead of the real window dimensions whenever rootWindowRect() is | |
| 315 // called. | |
| 316 WebKit::WebRect getFakeWindowRect(); | |
| 317 void setFakeWindowRect(const WebKit::WebRect&); | |
|
dglazkov
2009/09/23 18:17:14
these could be just straight accessor-style fake_w
| |
| 318 | |
| 309 WebWidgetHost* GetWidgetHost(); | 319 WebWidgetHost* GetWidgetHost(); |
| 310 | 320 |
| 311 void UpdateForCommittedLoad(WebKit::WebFrame* webframe, bool is_new_navigation ); | 321 void UpdateForCommittedLoad(WebKit::WebFrame* webframe, bool is_new_navigation ); |
| 312 void UpdateURL(WebKit::WebFrame* frame); | 322 void UpdateURL(WebKit::WebFrame* frame); |
| 313 void UpdateSessionHistory(WebKit::WebFrame* frame); | 323 void UpdateSessionHistory(WebKit::WebFrame* frame); |
| 314 void UpdateSelectionClipboard(bool is_empty_selection); | 324 void UpdateSelectionClipboard(bool is_empty_selection); |
| 315 | 325 |
| 316 // Get a string suitable for dumping a frame to the console. | 326 // Get a string suitable for dumping a frame to the console. |
| 317 std::wstring GetFrameDescription(WebKit::WebFrame* webframe); | 327 std::wstring GetFrameDescription(WebKit::WebFrame* webframe); |
| 318 | 328 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 342 | 352 |
| 343 // Maps resource identifiers to a descriptive string. | 353 // Maps resource identifiers to a descriptive string. |
| 344 typedef std::map<uint32, std::string> ResourceMap; | 354 typedef std::map<uint32, std::string> ResourceMap; |
| 345 ResourceMap resource_identifier_map_; | 355 ResourceMap resource_identifier_map_; |
| 346 std::string GetResourceDescription(uint32 identifier); | 356 std::string GetResourceDescription(uint32 identifier); |
| 347 | 357 |
| 348 CapturedContextMenuEvents captured_context_menu_events_; | 358 CapturedContextMenuEvents captured_context_menu_events_; |
| 349 | 359 |
| 350 WebCursor current_cursor_; | 360 WebCursor current_cursor_; |
| 351 | 361 |
| 362 WebKit::WebRect fake_rect_; | |
| 363 bool using_fake_rect_; | |
| 364 | |
| 352 #if defined(OS_WIN) | 365 #if defined(OS_WIN) |
| 353 // Classes needed by drag and drop. | 366 // Classes needed by drag and drop. |
| 354 scoped_refptr<TestDragDelegate> drag_delegate_; | 367 scoped_refptr<TestDragDelegate> drag_delegate_; |
| 355 scoped_refptr<TestDropDelegate> drop_delegate_; | 368 scoped_refptr<TestDropDelegate> drop_delegate_; |
| 356 #endif | 369 #endif |
| 357 | 370 |
| 358 #if defined(OS_LINUX) | 371 #if defined(OS_LINUX) |
| 359 // The type of cursor the window is currently using. | 372 // The type of cursor the window is currently using. |
| 360 // Used for judging whether a new SetCursor call is actually changing the | 373 // Used for judging whether a new SetCursor call is actually changing the |
| 361 // cursor. | 374 // cursor. |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 373 // true if we want to enable selection of trailing whitespaces | 386 // true if we want to enable selection of trailing whitespaces |
| 374 bool select_trailing_whitespace_enabled_; | 387 bool select_trailing_whitespace_enabled_; |
| 375 | 388 |
| 376 // true if we should block any redirects | 389 // true if we should block any redirects |
| 377 bool block_redirects_; | 390 bool block_redirects_; |
| 378 | 391 |
| 379 DISALLOW_COPY_AND_ASSIGN(TestWebViewDelegate); | 392 DISALLOW_COPY_AND_ASSIGN(TestWebViewDelegate); |
| 380 }; | 393 }; |
| 381 | 394 |
| 382 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ | 395 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEBVIEW_DELEGATE_H_ |
| OLD | NEW |