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 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/file_path.h" | 12 #include "base/file_path.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_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
17 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
| 18 #include "third_party/WebKit/WebKit/chromium/public/WebAnimationController.h" |
18 #include "third_party/WebKit/WebKit/chromium/public/WebBindings.h" | 19 #include "third_party/WebKit/WebKit/chromium/public/WebBindings.h" |
19 #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" | 20 #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" |
20 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" | 21 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" |
21 #include "third_party/WebKit/WebKit/chromium/public/WebElement.h" | 22 #include "third_party/WebKit/WebKit/chromium/public/WebElement.h" |
22 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" | 23 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" |
23 #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationServiceMock.h" | 24 #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationServiceMock.h" |
24 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" | 25 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" |
25 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" | 26 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" |
26 #include "third_party/WebKit/WebKit/chromium/public/WebSecurityPolicy.h" | 27 #include "third_party/WebKit/WebKit/chromium/public/WebSecurityPolicy.h" |
27 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" | 28 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 BindMethod("pathToLocalResource", &LayoutTestController::pathToLocalResource); | 123 BindMethod("pathToLocalResource", &LayoutTestController::pathToLocalResource); |
123 BindMethod("addFileToPasteboardOnDrag", &LayoutTestController::addFileToPasteb
oardOnDrag); | 124 BindMethod("addFileToPasteboardOnDrag", &LayoutTestController::addFileToPasteb
oardOnDrag); |
124 BindMethod("execCommand", &LayoutTestController::execCommand); | 125 BindMethod("execCommand", &LayoutTestController::execCommand); |
125 BindMethod("isCommandEnabled", &LayoutTestController::isCommandEnabled); | 126 BindMethod("isCommandEnabled", &LayoutTestController::isCommandEnabled); |
126 BindMethod("setPopupBlockingEnabled", &LayoutTestController::setPopupBlockingE
nabled); | 127 BindMethod("setPopupBlockingEnabled", &LayoutTestController::setPopupBlockingE
nabled); |
127 BindMethod("setStopProvisionalFrameLoads", &LayoutTestController::setStopProvi
sionalFrameLoads); | 128 BindMethod("setStopProvisionalFrameLoads", &LayoutTestController::setStopProvi
sionalFrameLoads); |
128 BindMethod("setSmartInsertDeleteEnabled", &LayoutTestController::setSmartInser
tDeleteEnabled); | 129 BindMethod("setSmartInsertDeleteEnabled", &LayoutTestController::setSmartInser
tDeleteEnabled); |
129 BindMethod("setSelectTrailingWhitespaceEnabled", &LayoutTestController::setSel
ectTrailingWhitespaceEnabled); | 130 BindMethod("setSelectTrailingWhitespaceEnabled", &LayoutTestController::setSel
ectTrailingWhitespaceEnabled); |
130 BindMethod("pauseAnimationAtTimeOnElementWithId", &LayoutTestController::pause
AnimationAtTimeOnElementWithId); | 131 BindMethod("pauseAnimationAtTimeOnElementWithId", &LayoutTestController::pause
AnimationAtTimeOnElementWithId); |
131 BindMethod("pauseTransitionAtTimeOnElementWithId", &LayoutTestController::paus
eTransitionAtTimeOnElementWithId); | 132 BindMethod("pauseTransitionAtTimeOnElementWithId", &LayoutTestController::paus
eTransitionAtTimeOnElementWithId); |
| 133 BindMethod("suspendAnimations", &LayoutTestController::suspendAnimations); |
| 134 BindMethod("resumeAnimations", &LayoutTestController::resumeAnimations); |
132 BindMethod("elementDoesAutoCompleteForElementWithId", &LayoutTestController::e
lementDoesAutoCompleteForElementWithId); | 135 BindMethod("elementDoesAutoCompleteForElementWithId", &LayoutTestController::e
lementDoesAutoCompleteForElementWithId); |
133 BindMethod("numberOfActiveAnimations", &LayoutTestController::numberOfActiveAn
imations); | 136 BindMethod("numberOfActiveAnimations", &LayoutTestController::numberOfActiveAn
imations); |
134 BindMethod("disableImageLoading", &LayoutTestController::disableImageLoading); | 137 BindMethod("disableImageLoading", &LayoutTestController::disableImageLoading); |
135 BindMethod("setIconDatabaseEnabled", &LayoutTestController::setIconDatabaseEna
bled); | 138 BindMethod("setIconDatabaseEnabled", &LayoutTestController::setIconDatabaseEna
bled); |
136 BindMethod("setCustomPolicyDelegate", &LayoutTestController::setCustomPolicyDe
legate); | 139 BindMethod("setCustomPolicyDelegate", &LayoutTestController::setCustomPolicyDe
legate); |
137 BindMethod("setScrollbarPolicy", &LayoutTestController::setScrollbarPolicy); | 140 BindMethod("setScrollbarPolicy", &LayoutTestController::setScrollbarPolicy); |
138 BindMethod("waitForPolicyDelegate", &LayoutTestController::waitForPolicyDelega
te); | 141 BindMethod("waitForPolicyDelegate", &LayoutTestController::waitForPolicyDelega
te); |
139 BindMethod("setWillSendRequestClearHeader", &LayoutTestController::setWillSend
RequestClearHeader); | 142 BindMethod("setWillSendRequestClearHeader", &LayoutTestController::setWillSend
RequestClearHeader); |
140 BindMethod("setWillSendRequestReturnsNullOnRedirect", &LayoutTestController::s
etWillSendRequestReturnsNullOnRedirect); | 143 BindMethod("setWillSendRequestReturnsNullOnRedirect", &LayoutTestController::s
etWillSendRequestReturnsNullOnRedirect); |
141 BindMethod("setWillSendRequestReturnsNull", &LayoutTestController::setWillSend
RequestReturnsNull); | 144 BindMethod("setWillSendRequestReturnsNull", &LayoutTestController::setWillSend
RequestReturnsNull); |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 double time = args[1].ToDouble(); | 825 double time = args[1].ToDouble(); |
823 std::string element_id = args[2].ToString(); | 826 std::string element_id = args[2].ToString(); |
824 | 827 |
825 result->Set(webkit_glue::PauseTransitionAtTimeOnElementWithId( | 828 result->Set(webkit_glue::PauseTransitionAtTimeOnElementWithId( |
826 shell_->webView(), property_name, time, element_id)); | 829 shell_->webView(), property_name, time, element_id)); |
827 } else { | 830 } else { |
828 result->Set(false); | 831 result->Set(false); |
829 } | 832 } |
830 } | 833 } |
831 | 834 |
| 835 void LayoutTestController::suspendAnimations( |
| 836 const CppArgumentList& args, CppVariant* result) { |
| 837 result->SetNull(); |
| 838 |
| 839 WebKit::WebFrame* web_frame = shell_->webView()->mainFrame(); |
| 840 if (!web_frame) |
| 841 return; |
| 842 |
| 843 WebKit::WebAnimationController* controller = web_frame->animationController(); |
| 844 if (!controller) |
| 845 return; |
| 846 controller->suspendAnimations(); |
| 847 } |
| 848 |
| 849 void LayoutTestController::resumeAnimations( |
| 850 const CppArgumentList& args, CppVariant* result) { |
| 851 result->SetNull(); |
| 852 |
| 853 WebKit::WebFrame* web_frame = shell_->webView()->mainFrame(); |
| 854 if (!web_frame) |
| 855 return; |
| 856 |
| 857 WebKit::WebAnimationController* controller = web_frame->animationController(); |
| 858 if (!controller) |
| 859 return; |
| 860 controller->resumeAnimations(); |
| 861 } |
| 862 |
832 void LayoutTestController::elementDoesAutoCompleteForElementWithId( | 863 void LayoutTestController::elementDoesAutoCompleteForElementWithId( |
833 const CppArgumentList& args, | 864 const CppArgumentList& args, |
834 CppVariant* result) { | 865 CppVariant* result) { |
835 if (args.size() != 1 || !args[0].isString()) { | 866 if (args.size() != 1 || !args[0].isString()) { |
836 result->Set(false); | 867 result->Set(false); |
837 return; | 868 return; |
838 } | 869 } |
839 std::string element_id = args[0].ToString(); | 870 std::string element_id = args[0].ToString(); |
840 result->Set(webkit_glue::ElementDoesAutoCompleteForElementWithId( | 871 result->Set(webkit_glue::ElementDoesAutoCompleteForElementWithId( |
841 shell_->webView(), element_id)); | 872 shell_->webView(), element_id)); |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1344 | 1375 |
1345 void LayoutTestController::markerTextForListItem(const CppArgumentList& args, | 1376 void LayoutTestController::markerTextForListItem(const CppArgumentList& args, |
1346 CppVariant* result) { | 1377 CppVariant* result) { |
1347 WebElement element; | 1378 WebElement element; |
1348 if (!WebBindings::getElement(args[0].value.objectValue, &element)) | 1379 if (!WebBindings::getElement(args[0].value.objectValue, &element)) |
1349 result->SetNull(); | 1380 result->SetNull(); |
1350 else | 1381 else |
1351 result->Set( | 1382 result->Set( |
1352 element.document().frame()->markerTextForListItem(element).utf8()); | 1383 element.document().frame()->markerTextForListItem(element).utf8()); |
1353 } | 1384 } |
OLD | NEW |