| 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 // 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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
| 16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 17 #include "webkit/glue/dom_operations.h" |
| 17 #include "webkit/glue/webframe.h" | 18 #include "webkit/glue/webframe.h" |
| 18 #include "webkit/glue/webpreferences.h" | 19 #include "webkit/glue/webpreferences.h" |
| 19 #include "webkit/glue/webview.h" | 20 #include "webkit/glue/webview.h" |
| 20 #include "webkit/tools/test_shell/test_shell.h" | 21 #include "webkit/tools/test_shell/test_shell.h" |
| 21 | 22 |
| 22 using std::string; | 23 using std::string; |
| 23 using std::wstring; | 24 using std::wstring; |
| 24 | 25 |
| 25 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
| 26 namespace { | 27 namespace { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 BindMethod("setUserStyleSheetLocation", &LayoutTestController::setUserStyleShe
etLocation); | 91 BindMethod("setUserStyleSheetLocation", &LayoutTestController::setUserStyleShe
etLocation); |
| 91 BindMethod("setUserStyleSheetEnabled", &LayoutTestController::setUserStyleShee
tEnabled); | 92 BindMethod("setUserStyleSheetEnabled", &LayoutTestController::setUserStyleShee
tEnabled); |
| 92 BindMethod("pathToLocalResource", &LayoutTestController::pathToLocalResource); | 93 BindMethod("pathToLocalResource", &LayoutTestController::pathToLocalResource); |
| 93 BindMethod("addFileToPasteboardOnDrag", &LayoutTestController::addFileToPasteb
oardOnDrag); | 94 BindMethod("addFileToPasteboardOnDrag", &LayoutTestController::addFileToPasteb
oardOnDrag); |
| 94 BindMethod("execCommand", &LayoutTestController::execCommand); | 95 BindMethod("execCommand", &LayoutTestController::execCommand); |
| 95 BindMethod("isCommandEnabled", &LayoutTestController::isCommandEnabled); | 96 BindMethod("isCommandEnabled", &LayoutTestController::isCommandEnabled); |
| 96 BindMethod("setPopupBlockingEnabled", &LayoutTestController::setPopupBlockingE
nabled); | 97 BindMethod("setPopupBlockingEnabled", &LayoutTestController::setPopupBlockingE
nabled); |
| 97 BindMethod("setStopProvisionalFrameLoads", &LayoutTestController::setStopProvi
sionalFrameLoads); | 98 BindMethod("setStopProvisionalFrameLoads", &LayoutTestController::setStopProvi
sionalFrameLoads); |
| 98 BindMethod("setSmartInsertDeleteEnabled", &LayoutTestController::setSmartInser
tDeleteEnabled); | 99 BindMethod("setSmartInsertDeleteEnabled", &LayoutTestController::setSmartInser
tDeleteEnabled); |
| 99 BindMethod("setSelectTrailingWhitespaceEnabled", &LayoutTestController::setSel
ectTrailingWhitespaceEnabled); | 100 BindMethod("setSelectTrailingWhitespaceEnabled", &LayoutTestController::setSel
ectTrailingWhitespaceEnabled); |
| 101 BindMethod("pauseAnimationAtTimeOnElementWithId", &LayoutTestController::pause
AnimationAtTimeOnElementWithId); |
| 102 BindMethod("pauseTransitionAtTimeOnElementWithId", &LayoutTestController::paus
eTransitionAtTimeOnElementWithId); |
| 100 | 103 |
| 101 // The following are stubs. | 104 // The following are stubs. |
| 102 BindMethod("dumpAsWebArchive", &LayoutTestController::dumpAsWebArchive); | 105 BindMethod("dumpAsWebArchive", &LayoutTestController::dumpAsWebArchive); |
| 103 BindMethod("setMainFrameIsFirstResponder", &LayoutTestController::setMainFrame
IsFirstResponder); | 106 BindMethod("setMainFrameIsFirstResponder", &LayoutTestController::setMainFrame
IsFirstResponder); |
| 104 BindMethod("dumpSelectionRect", &LayoutTestController::dumpSelectionRect); | 107 BindMethod("dumpSelectionRect", &LayoutTestController::dumpSelectionRect); |
| 105 BindMethod("display", &LayoutTestController::display); | 108 BindMethod("display", &LayoutTestController::display); |
| 106 BindMethod("testRepaint", &LayoutTestController::testRepaint); | 109 BindMethod("testRepaint", &LayoutTestController::testRepaint); |
| 107 BindMethod("repaintSweepHorizontally", &LayoutTestController::repaintSweepHori
zontally); | 110 BindMethod("repaintSweepHorizontally", &LayoutTestController::repaintSweepHori
zontally); |
| 108 BindMethod("clearBackForwardList", &LayoutTestController::clearBackForwardList
); | 111 BindMethod("clearBackForwardList", &LayoutTestController::clearBackForwardList
); |
| 109 BindMethod("keepWebHistory", &LayoutTestController::keepWebHistory); | 112 BindMethod("keepWebHistory", &LayoutTestController::keepWebHistory); |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 void LayoutTestController::setSelectTrailingWhitespaceEnabled( | 564 void LayoutTestController::setSelectTrailingWhitespaceEnabled( |
| 562 const CppArgumentList& args, CppVariant* result) { | 565 const CppArgumentList& args, CppVariant* result) { |
| 563 if (args.size() > 0 && args[0].isBool()) { | 566 if (args.size() > 0 && args[0].isBool()) { |
| 564 shell_->delegate()->SetSelectTrailingWhitespaceEnabled( | 567 shell_->delegate()->SetSelectTrailingWhitespaceEnabled( |
| 565 args[0].value.boolValue); | 568 args[0].value.boolValue); |
| 566 } | 569 } |
| 567 | 570 |
| 568 result->SetNull(); | 571 result->SetNull(); |
| 569 } | 572 } |
| 570 | 573 |
| 574 void LayoutTestController::pauseAnimationAtTimeOnElementWithId( |
| 575 const CppArgumentList& args, |
| 576 CppVariant* result) { |
| 577 if (args.size() > 2 && args[0].isString() && args[1].isNumber() && |
| 578 args[2].isString()) { |
| 579 std::string animation_name = args[0].ToString(); |
| 580 double time = args[1].ToDouble(); |
| 581 std::string element_id = args[2].ToString(); |
| 582 |
| 583 result->Set( |
| 584 webkit_glue::PauseAnimationAtTimeOnElementWithId( |
| 585 shell_->webView(), animation_name, time, element_id)); |
| 586 } else { |
| 587 result->Set(false); |
| 588 } |
| 589 } |
| 590 |
| 591 void LayoutTestController::pauseTransitionAtTimeOnElementWithId( |
| 592 const CppArgumentList& args, |
| 593 CppVariant* result) { |
| 594 if (args.size() > 2 && args[0].isString() && args[1].isNumber() && |
| 595 args[2].isString()) { |
| 596 std::string property_name = args[0].ToString(); |
| 597 double time = args[1].ToDouble(); |
| 598 std::string element_id = args[2].ToString(); |
| 599 |
| 600 webkit_glue::PauseTransitionAtTimeOnElementWithId( |
| 601 shell_->webView(), property_name, time, element_id); |
| 602 } else { |
| 603 result->Set(false); |
| 604 } |
| 605 } |
| 606 |
| 571 // | 607 // |
| 572 // Unimplemented stubs | 608 // Unimplemented stubs |
| 573 // | 609 // |
| 574 | 610 |
| 575 void LayoutTestController::dumpAsWebArchive( | 611 void LayoutTestController::dumpAsWebArchive( |
| 576 const CppArgumentList& args, CppVariant* result) { | 612 const CppArgumentList& args, CppVariant* result) { |
| 577 result->SetNull(); | 613 result->SetNull(); |
| 578 } | 614 } |
| 579 | 615 |
| 580 void LayoutTestController::setMainFrameIsFirstResponder( | 616 void LayoutTestController::setMainFrameIsFirstResponder( |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 void LayoutTestController::fallbackMethod( | 678 void LayoutTestController::fallbackMethod( |
| 643 const CppArgumentList& args, CppVariant* result) { | 679 const CppArgumentList& args, CppVariant* result) { |
| 644 std::wstring message(L"JavaScript ERROR: unknown method called on LayoutTestCo
ntroller"); | 680 std::wstring message(L"JavaScript ERROR: unknown method called on LayoutTestCo
ntroller"); |
| 645 if (!shell_->layout_test_mode()) { | 681 if (!shell_->layout_test_mode()) { |
| 646 logging::LogMessage("CONSOLE:", 0).stream() << message; | 682 logging::LogMessage("CONSOLE:", 0).stream() << message; |
| 647 } else { | 683 } else { |
| 648 printf("CONSOLE MESSAGE: %S\n", message.c_str()); | 684 printf("CONSOLE MESSAGE: %S\n", message.c_str()); |
| 649 } | 685 } |
| 650 result->SetNull(); | 686 result->SetNull(); |
| 651 } | 687 } |
| OLD | NEW |