| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file contains the definition for LayoutTestController. | 5 // This file contains the definition for LayoutTestController. |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "webkit/tools/test_shell/layout_test_controller.h" | 9 #include "webkit/tools/test_shell/layout_test_controller.h" |
| 10 | 10 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 using WebKit::WebURL; | 54 using WebKit::WebURL; |
| 55 | 55 |
| 56 TestShell* LayoutTestController::shell_ = NULL; | 56 TestShell* LayoutTestController::shell_ = NULL; |
| 57 // Most of these flags need to be cleared in Reset() so that they get turned | 57 // Most of these flags need to be cleared in Reset() so that they get turned |
| 58 // off between each test run. | 58 // off between each test run. |
| 59 bool LayoutTestController::generate_pixel_results_ = true; | 59 bool LayoutTestController::generate_pixel_results_ = true; |
| 60 bool LayoutTestController::dump_as_text_ = false; | 60 bool LayoutTestController::dump_as_text_ = false; |
| 61 bool LayoutTestController::dump_editing_callbacks_ = false; | 61 bool LayoutTestController::dump_editing_callbacks_ = false; |
| 62 bool LayoutTestController::dump_frame_load_callbacks_ = false; | 62 bool LayoutTestController::dump_frame_load_callbacks_ = false; |
| 63 bool LayoutTestController::dump_resource_load_callbacks_ = false; | 63 bool LayoutTestController::dump_resource_load_callbacks_ = false; |
| 64 bool LayoutTestController::dump_resource_response_mime_types_ = false; |
| 64 bool LayoutTestController::dump_back_forward_list_ = false; | 65 bool LayoutTestController::dump_back_forward_list_ = false; |
| 65 bool LayoutTestController::dump_child_frame_scroll_positions_ = false; | 66 bool LayoutTestController::dump_child_frame_scroll_positions_ = false; |
| 66 bool LayoutTestController::dump_child_frames_as_text_ = false; | 67 bool LayoutTestController::dump_child_frames_as_text_ = false; |
| 67 bool LayoutTestController::dump_window_status_changes_ = false; | 68 bool LayoutTestController::dump_window_status_changes_ = false; |
| 68 bool LayoutTestController::dump_title_changes_ = false; | 69 bool LayoutTestController::dump_title_changes_ = false; |
| 69 bool LayoutTestController::dump_selection_rect_ = false; | 70 bool LayoutTestController::dump_selection_rect_ = false; |
| 70 bool LayoutTestController::accepts_editing_ = true; | 71 bool LayoutTestController::accepts_editing_ = true; |
| 71 bool LayoutTestController::wait_until_done_ = false; | 72 bool LayoutTestController::wait_until_done_ = false; |
| 72 bool LayoutTestController::can_open_windows_ = false; | 73 bool LayoutTestController::can_open_windows_ = false; |
| 73 bool LayoutTestController::close_remaining_windows_ = true; | 74 bool LayoutTestController::close_remaining_windows_ = true; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 92 // names to their methods will be done by calling BindToJavaScript() (defined | 93 // names to their methods will be done by calling BindToJavaScript() (defined |
| 93 // by CppBoundClass, the parent to LayoutTestController). | 94 // by CppBoundClass, the parent to LayoutTestController). |
| 94 BindMethod("dumpAsText", &LayoutTestController::dumpAsText); | 95 BindMethod("dumpAsText", &LayoutTestController::dumpAsText); |
| 95 BindMethod("dumpChildFrameScrollPositions", &LayoutTestController::dumpChildFr
ameScrollPositions); | 96 BindMethod("dumpChildFrameScrollPositions", &LayoutTestController::dumpChildFr
ameScrollPositions); |
| 96 BindMethod("dumpChildFramesAsText", &LayoutTestController::dumpChildFramesAsTe
xt); | 97 BindMethod("dumpChildFramesAsText", &LayoutTestController::dumpChildFramesAsTe
xt); |
| 97 BindMethod("dumpDatabaseCallbacks", &LayoutTestController::dumpDatabaseCallbac
ks); | 98 BindMethod("dumpDatabaseCallbacks", &LayoutTestController::dumpDatabaseCallbac
ks); |
| 98 BindMethod("dumpEditingCallbacks", &LayoutTestController::dumpEditingCallbacks
); | 99 BindMethod("dumpEditingCallbacks", &LayoutTestController::dumpEditingCallbacks
); |
| 99 BindMethod("dumpBackForwardList", &LayoutTestController::dumpBackForwardList); | 100 BindMethod("dumpBackForwardList", &LayoutTestController::dumpBackForwardList); |
| 100 BindMethod("dumpFrameLoadCallbacks", &LayoutTestController::dumpFrameLoadCallb
acks); | 101 BindMethod("dumpFrameLoadCallbacks", &LayoutTestController::dumpFrameLoadCallb
acks); |
| 101 BindMethod("dumpResourceLoadCallbacks", &LayoutTestController::dumpResourceLoa
dCallbacks); | 102 BindMethod("dumpResourceLoadCallbacks", &LayoutTestController::dumpResourceLoa
dCallbacks); |
| 103 BindMethod("dumpResourceResponseMIMETypes", &LayoutTestController::dumpResourc
eResponseMIMETypes); |
| 102 BindMethod("dumpStatusCallbacks", &LayoutTestController::dumpWindowStatusChang
es); | 104 BindMethod("dumpStatusCallbacks", &LayoutTestController::dumpWindowStatusChang
es); |
| 103 BindMethod("dumpTitleChanges", &LayoutTestController::dumpTitleChanges); | 105 BindMethod("dumpTitleChanges", &LayoutTestController::dumpTitleChanges); |
| 104 BindMethod("setAcceptsEditing", &LayoutTestController::setAcceptsEditing); | 106 BindMethod("setAcceptsEditing", &LayoutTestController::setAcceptsEditing); |
| 105 BindMethod("waitUntilDone", &LayoutTestController::waitUntilDone); | 107 BindMethod("waitUntilDone", &LayoutTestController::waitUntilDone); |
| 106 BindMethod("notifyDone", &LayoutTestController::notifyDone); | 108 BindMethod("notifyDone", &LayoutTestController::notifyDone); |
| 107 BindMethod("queueReload", &LayoutTestController::queueReload); | 109 BindMethod("queueReload", &LayoutTestController::queueReload); |
| 108 BindMethod("queueLoadingScript", &LayoutTestController::queueLoadingScript); | 110 BindMethod("queueLoadingScript", &LayoutTestController::queueLoadingScript); |
| 109 BindMethod("queueNonLoadingScript", &LayoutTestController::queueNonLoadingScri
pt); | 111 BindMethod("queueNonLoadingScript", &LayoutTestController::queueNonLoadingScri
pt); |
| 110 BindMethod("queueLoad", &LayoutTestController::queueLoad); | 112 BindMethod("queueLoad", &LayoutTestController::queueLoad); |
| 111 BindMethod("queueBackNavigation", &LayoutTestController::queueBackNavigation); | 113 BindMethod("queueBackNavigation", &LayoutTestController::queueBackNavigation); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 dump_frame_load_callbacks_ = true; | 292 dump_frame_load_callbacks_ = true; |
| 291 result->SetNull(); | 293 result->SetNull(); |
| 292 } | 294 } |
| 293 | 295 |
| 294 void LayoutTestController::dumpResourceLoadCallbacks( | 296 void LayoutTestController::dumpResourceLoadCallbacks( |
| 295 const CppArgumentList& args, CppVariant* result) { | 297 const CppArgumentList& args, CppVariant* result) { |
| 296 dump_resource_load_callbacks_ = true; | 298 dump_resource_load_callbacks_ = true; |
| 297 result->SetNull(); | 299 result->SetNull(); |
| 298 } | 300 } |
| 299 | 301 |
| 302 void LayoutTestController::dumpResourceResponseMIMETypes( |
| 303 const CppArgumentList& args, CppVariant* result) { |
| 304 dump_resource_response_mime_types_ = true; |
| 305 result->SetNull(); |
| 306 } |
| 307 |
| 300 void LayoutTestController::dumpChildFrameScrollPositions( | 308 void LayoutTestController::dumpChildFrameScrollPositions( |
| 301 const CppArgumentList& args, CppVariant* result) { | 309 const CppArgumentList& args, CppVariant* result) { |
| 302 dump_child_frame_scroll_positions_ = true; | 310 dump_child_frame_scroll_positions_ = true; |
| 303 result->SetNull(); | 311 result->SetNull(); |
| 304 } | 312 } |
| 305 | 313 |
| 306 void LayoutTestController::dumpChildFramesAsText( | 314 void LayoutTestController::dumpChildFramesAsText( |
| 307 const CppArgumentList& args, CppVariant* result) { | 315 const CppArgumentList& args, CppVariant* result) { |
| 308 dump_child_frames_as_text_ = true; | 316 dump_child_frames_as_text_ = true; |
| 309 result->SetNull(); | 317 result->SetNull(); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 #else | 520 #else |
| 513 shell_->webView()->settings()->setEditingBehavior( | 521 shell_->webView()->settings()->setEditingBehavior( |
| 514 WebKit::WebSettings::EditingBehaviorWin); | 522 WebKit::WebSettings::EditingBehaviorWin); |
| 515 #endif | 523 #endif |
| 516 } | 524 } |
| 517 generate_pixel_results_ = true; | 525 generate_pixel_results_ = true; |
| 518 dump_as_text_ = false; | 526 dump_as_text_ = false; |
| 519 dump_editing_callbacks_ = false; | 527 dump_editing_callbacks_ = false; |
| 520 dump_frame_load_callbacks_ = false; | 528 dump_frame_load_callbacks_ = false; |
| 521 dump_resource_load_callbacks_ = false; | 529 dump_resource_load_callbacks_ = false; |
| 530 dump_resource_response_mime_types_ = false; |
| 522 dump_back_forward_list_ = false; | 531 dump_back_forward_list_ = false; |
| 523 dump_child_frame_scroll_positions_ = false; | 532 dump_child_frame_scroll_positions_ = false; |
| 524 dump_child_frames_as_text_ = false; | 533 dump_child_frames_as_text_ = false; |
| 525 dump_window_status_changes_ = false; | 534 dump_window_status_changes_ = false; |
| 526 dump_selection_rect_ = false; | 535 dump_selection_rect_ = false; |
| 527 dump_title_changes_ = false; | 536 dump_title_changes_ = false; |
| 528 accepts_editing_ = true; | 537 accepts_editing_ = true; |
| 529 wait_until_done_ = false; | 538 wait_until_done_ = false; |
| 530 can_open_windows_ = false; | 539 can_open_windows_ = false; |
| 531 test_repaint_ = false; | 540 test_repaint_ = false; |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 void LayoutTestController::suspendAnimations( | 871 void LayoutTestController::suspendAnimations( |
| 863 const CppArgumentList& args, CppVariant* result) { | 872 const CppArgumentList& args, CppVariant* result) { |
| 864 result->SetNull(); | 873 result->SetNull(); |
| 865 | 874 |
| 866 WebKit::WebFrame* web_frame = shell_->webView()->mainFrame(); | 875 WebKit::WebFrame* web_frame = shell_->webView()->mainFrame(); |
| 867 if (!web_frame) | 876 if (!web_frame) |
| 868 return; | 877 return; |
| 869 | 878 |
| 870 WebKit::WebAnimationController* controller = web_frame->animationController(); | 879 WebKit::WebAnimationController* controller = web_frame->animationController(); |
| 871 if (!controller) | 880 if (!controller) |
| 872 return; | 881 return; |
| 873 controller->suspendAnimations(); | 882 controller->suspendAnimations(); |
| 874 } | 883 } |
| 875 | 884 |
| 876 void LayoutTestController::resumeAnimations( | 885 void LayoutTestController::resumeAnimations( |
| 877 const CppArgumentList& args, CppVariant* result) { | 886 const CppArgumentList& args, CppVariant* result) { |
| 878 result->SetNull(); | 887 result->SetNull(); |
| 879 | 888 |
| 880 WebKit::WebFrame* web_frame = shell_->webView()->mainFrame(); | 889 WebKit::WebFrame* web_frame = shell_->webView()->mainFrame(); |
| 881 if (!web_frame) | 890 if (!web_frame) |
| 882 return; | 891 return; |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 | 1427 |
| 1419 void LayoutTestController::markerTextForListItem(const CppArgumentList& args, | 1428 void LayoutTestController::markerTextForListItem(const CppArgumentList& args, |
| 1420 CppVariant* result) { | 1429 CppVariant* result) { |
| 1421 WebElement element; | 1430 WebElement element; |
| 1422 if (!WebBindings::getElement(args[0].value.objectValue, &element)) | 1431 if (!WebBindings::getElement(args[0].value.objectValue, &element)) |
| 1423 result->SetNull(); | 1432 result->SetNull(); |
| 1424 else | 1433 else |
| 1425 result->Set( | 1434 result->Set( |
| 1426 element.document().frame()->markerTextForListItem(element).utf8()); | 1435 element.document().frame()->markerTextForListItem(element).utf8()); |
| 1427 } | 1436 } |
| OLD | NEW |