| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 BindMethod("forceRedSelectionColors", &LayoutTestController::forceRedSelection
Colors); | 200 BindMethod("forceRedSelectionColors", &LayoutTestController::forceRedSelection
Colors); |
| 201 BindMethod("setEditingBehavior", &LayoutTestController::setEditingBehavior); | 201 BindMethod("setEditingBehavior", &LayoutTestController::setEditingBehavior); |
| 202 | 202 |
| 203 BindMethod("setGeolocationPermission", &LayoutTestController::setGeolocationPe
rmission); | 203 BindMethod("setGeolocationPermission", &LayoutTestController::setGeolocationPe
rmission); |
| 204 BindMethod("setMockGeolocationPosition", &LayoutTestController::setMockGeoloca
tionPosition); | 204 BindMethod("setMockGeolocationPosition", &LayoutTestController::setMockGeoloca
tionPosition); |
| 205 BindMethod("setMockGeolocationError", &LayoutTestController::setMockGeolocatio
nError); | 205 BindMethod("setMockGeolocationError", &LayoutTestController::setMockGeolocatio
nError); |
| 206 | 206 |
| 207 BindMethod("markerTextForListItem", &LayoutTestController::markerTextForListIt
em); | 207 BindMethod("markerTextForListItem", &LayoutTestController::markerTextForListIt
em); |
| 208 | 208 |
| 209 BindMethod("setMockDeviceOrientation", &LayoutTestController::setMockDeviceOri
entation); | 209 BindMethod("setMockDeviceOrientation", &LayoutTestController::setMockDeviceOri
entation); |
| 210 BindMethod("setMockSpeechInputResult", &LayoutTestController::setMockSpeechInp
utResult); | 210 BindMethod("addMockSpeechInputResult", &LayoutTestController::addMockSpeechInp
utResult); |
| 211 | 211 |
| 212 // The fallback method is called when an unknown method is invoked. | 212 // The fallback method is called when an unknown method is invoked. |
| 213 BindFallbackMethod(&LayoutTestController::fallbackMethod); | 213 BindFallbackMethod(&LayoutTestController::fallbackMethod); |
| 214 | 214 |
| 215 // Shared properties. | 215 // Shared properties. |
| 216 // globalFlag is used by a number of layout tests in | 216 // globalFlag is used by a number of layout tests in |
| 217 // LayoutTests\http\tests\security\dataURL. | 217 // LayoutTests\http\tests\security\dataURL. |
| 218 BindProperty("globalFlag", &globalFlag_); | 218 BindProperty("globalFlag", &globalFlag_); |
| 219 // webHistoryItemCount is used by tests in LayoutTests\http\tests\history | 219 // webHistoryItemCount is used by tests in LayoutTests\http\tests\history |
| 220 BindProperty("webHistoryItemCount", &webHistoryItemCount_); | 220 BindProperty("webHistoryItemCount", &webHistoryItemCount_); |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1126 void LayoutTestController::setAllowFileAccessFromFileURLs( | 1126 void LayoutTestController::setAllowFileAccessFromFileURLs( |
| 1127 const CppArgumentList& args, CppVariant* result) { | 1127 const CppArgumentList& args, CppVariant* result) { |
| 1128 if (args.size() > 0 && args[0].isBool()) { | 1128 if (args.size() > 0 && args[0].isBool()) { |
| 1129 WebPreferences* prefs = shell_->GetWebPreferences(); | 1129 WebPreferences* prefs = shell_->GetWebPreferences(); |
| 1130 prefs->allow_file_access_from_file_urls = args[0].value.boolValue; | 1130 prefs->allow_file_access_from_file_urls = args[0].value.boolValue; |
| 1131 prefs->Apply(shell_->webView()); | 1131 prefs->Apply(shell_->webView()); |
| 1132 } | 1132 } |
| 1133 result->SetNull(); | 1133 result->SetNull(); |
| 1134 } | 1134 } |
| 1135 | 1135 |
| 1136 void LayoutTestController::setMockSpeechInputResult(const CppArgumentList& args, | 1136 void LayoutTestController::addMockSpeechInputResult(const CppArgumentList& args, |
| 1137 CppVariant* result) { | 1137 CppVariant* result) { |
| 1138 if (args.size() > 0 && args[0].isString() && args[1].isString()) { | 1138 if (args.size() > 0 && args[0].isString() && args[1].isNumber() && |
| 1139 shell_->speech_input_controller_mock()->setMockRecognitionResult( | 1139 args[2].isString()) { |
| 1140 WebString::fromUTF8(args[0].ToString()), | 1140 shell_->speech_input_controller_mock()->addMockRecognitionResult( |
| 1141 WebString::fromUTF8(args[1].ToString())); | 1141 WebString::fromUTF8(args[0].ToString()), args[1].ToDouble(), |
| 1142 WebString::fromUTF8(args[2].ToString())); |
| 1142 } | 1143 } |
| 1143 result->SetNull(); | 1144 result->SetNull(); |
| 1144 } | 1145 } |
| 1145 | 1146 |
| 1146 // Need these conversions because the format of the value for booleans | 1147 // Need these conversions because the format of the value for booleans |
| 1147 // may vary - for example, on mac "1" and "0" are used for boolean. | 1148 // may vary - for example, on mac "1" and "0" are used for boolean. |
| 1148 bool LayoutTestController::CppVariantToBool(const CppVariant& value) { | 1149 bool LayoutTestController::CppVariantToBool(const CppVariant& value) { |
| 1149 if (value.isBool()) | 1150 if (value.isBool()) |
| 1150 return value.ToBoolean(); | 1151 return value.ToBoolean(); |
| 1151 else if (value.isNumber()) | 1152 else if (value.isNumber()) |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1539 shell_->device_orientation_client_mock()->setOrientation(orientation); | 1540 shell_->device_orientation_client_mock()->setOrientation(orientation); |
| 1540 } | 1541 } |
| 1541 | 1542 |
| 1542 void LayoutTestController::hasSpellingMarker(const CppArgumentList& arguments, | 1543 void LayoutTestController::hasSpellingMarker(const CppArgumentList& arguments, |
| 1543 CppVariant* result) { | 1544 CppVariant* result) { |
| 1544 if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isNumber
()) | 1545 if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isNumber
()) |
| 1545 return; | 1546 return; |
| 1546 result->Set(shell_->webView()->mainFrame()->selectionStartHasSpellingMarkerFor
( | 1547 result->Set(shell_->webView()->mainFrame()->selectionStartHasSpellingMarkerFor
( |
| 1547 arguments[0].ToInt32(), arguments[1].ToInt32())); | 1548 arguments[0].ToInt32(), arguments[1].ToInt32())); |
| 1548 } | 1549 } |
| OLD | NEW |