| 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 14 matching lines...) Expand all Loading... |
| 25 #include "third_party/WebKit/WebKit/chromium/public/WebDeviceOrientationClientMo
ck.h" | 25 #include "third_party/WebKit/WebKit/chromium/public/WebDeviceOrientationClientMo
ck.h" |
| 26 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" | 26 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" |
| 27 #include "third_party/WebKit/WebKit/chromium/public/WebElement.h" | 27 #include "third_party/WebKit/WebKit/chromium/public/WebElement.h" |
| 28 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" | 28 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" |
| 29 #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationServiceMock.h" | 29 #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationServiceMock.h" |
| 30 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" | 30 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" |
| 31 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" | 31 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" |
| 32 #include "third_party/WebKit/WebKit/chromium/public/WebSecurityPolicy.h" | 32 #include "third_party/WebKit/WebKit/chromium/public/WebSecurityPolicy.h" |
| 33 #include "third_party/WebKit/WebKit/chromium/public/WebSettings.h" | 33 #include "third_party/WebKit/WebKit/chromium/public/WebSettings.h" |
| 34 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" | 34 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" |
| 35 #include "third_party/WebKit/WebKit/chromium/public/WebSpeechInputControllerMock
.h" |
| 35 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" | 36 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" |
| 36 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" | 37 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" |
| 37 #include "webkit/glue/dom_operations.h" | 38 #include "webkit/glue/dom_operations.h" |
| 38 #include "webkit/glue/webkit_glue.h" | 39 #include "webkit/glue/webkit_glue.h" |
| 39 #include "webkit/glue/webpreferences.h" | 40 #include "webkit/glue/webpreferences.h" |
| 40 #include "webkit/tools/test_shell/notification_presenter.h" | 41 #include "webkit/tools/test_shell/notification_presenter.h" |
| 41 #include "webkit/tools/test_shell/simple_database_system.h" | 42 #include "webkit/tools/test_shell/simple_database_system.h" |
| 42 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" | 43 #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" |
| 43 #include "webkit/tools/test_shell/test_navigation_controller.h" | 44 #include "webkit/tools/test_shell/test_navigation_controller.h" |
| 44 #include "webkit/tools/test_shell/test_shell.h" | 45 #include "webkit/tools/test_shell/test_shell.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 BindMethod("forceRedSelectionColors", &LayoutTestController::forceRedSelection
Colors); | 197 BindMethod("forceRedSelectionColors", &LayoutTestController::forceRedSelection
Colors); |
| 197 BindMethod("setEditingBehavior", &LayoutTestController::setEditingBehavior); | 198 BindMethod("setEditingBehavior", &LayoutTestController::setEditingBehavior); |
| 198 | 199 |
| 199 BindMethod("setGeolocationPermission", &LayoutTestController::setGeolocationPe
rmission); | 200 BindMethod("setGeolocationPermission", &LayoutTestController::setGeolocationPe
rmission); |
| 200 BindMethod("setMockGeolocationPosition", &LayoutTestController::setMockGeoloca
tionPosition); | 201 BindMethod("setMockGeolocationPosition", &LayoutTestController::setMockGeoloca
tionPosition); |
| 201 BindMethod("setMockGeolocationError", &LayoutTestController::setMockGeolocatio
nError); | 202 BindMethod("setMockGeolocationError", &LayoutTestController::setMockGeolocatio
nError); |
| 202 | 203 |
| 203 BindMethod("markerTextForListItem", &LayoutTestController::markerTextForListIt
em); | 204 BindMethod("markerTextForListItem", &LayoutTestController::markerTextForListIt
em); |
| 204 | 205 |
| 205 BindMethod("setMockDeviceOrientation", &LayoutTestController::setMockDeviceOri
entation); | 206 BindMethod("setMockDeviceOrientation", &LayoutTestController::setMockDeviceOri
entation); |
| 207 BindMethod("setMockSpeechInputResult", &LayoutTestController::setMockSpeechInp
utResult); |
| 206 | 208 |
| 207 // The fallback method is called when an unknown method is invoked. | 209 // The fallback method is called when an unknown method is invoked. |
| 208 BindFallbackMethod(&LayoutTestController::fallbackMethod); | 210 BindFallbackMethod(&LayoutTestController::fallbackMethod); |
| 209 | 211 |
| 210 // Shared properties. | 212 // Shared properties. |
| 211 // globalFlag is used by a number of layout tests in | 213 // globalFlag is used by a number of layout tests in |
| 212 // LayoutTests\http\tests\security\dataURL. | 214 // LayoutTests\http\tests\security\dataURL. |
| 213 BindProperty("globalFlag", &globalFlag_); | 215 BindProperty("globalFlag", &globalFlag_); |
| 214 // webHistoryItemCount is used by tests in LayoutTests\http\tests\history | 216 // webHistoryItemCount is used by tests in LayoutTests\http\tests\history |
| 215 BindProperty("webHistoryItemCount", &webHistoryItemCount_); | 217 BindProperty("webHistoryItemCount", &webHistoryItemCount_); |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1102 void LayoutTestController::setAllowFileAccessFromFileURLs( | 1104 void LayoutTestController::setAllowFileAccessFromFileURLs( |
| 1103 const CppArgumentList& args, CppVariant* result) { | 1105 const CppArgumentList& args, CppVariant* result) { |
| 1104 if (args.size() > 0 && args[0].isBool()) { | 1106 if (args.size() > 0 && args[0].isBool()) { |
| 1105 WebPreferences* prefs = shell_->GetWebPreferences(); | 1107 WebPreferences* prefs = shell_->GetWebPreferences(); |
| 1106 prefs->allow_file_access_from_file_urls = args[0].value.boolValue; | 1108 prefs->allow_file_access_from_file_urls = args[0].value.boolValue; |
| 1107 prefs->Apply(shell_->webView()); | 1109 prefs->Apply(shell_->webView()); |
| 1108 } | 1110 } |
| 1109 result->SetNull(); | 1111 result->SetNull(); |
| 1110 } | 1112 } |
| 1111 | 1113 |
| 1114 void LayoutTestController::setMockSpeechInputResult(const CppArgumentList& args, |
| 1115 CppVariant* result) { |
| 1116 if (args.size() > 0 && args[0].isString()) { |
| 1117 shell_->speech_input_controller_mock()->setMockRecognitionResult( |
| 1118 WebString::fromUTF8(args[0].ToString())); |
| 1119 } |
| 1120 result->SetNull(); |
| 1121 } |
| 1122 |
| 1112 // Need these conversions because the format of the value for booleans | 1123 // Need these conversions because the format of the value for booleans |
| 1113 // may vary - for example, on mac "1" and "0" are used for boolean. | 1124 // may vary - for example, on mac "1" and "0" are used for boolean. |
| 1114 bool LayoutTestController::CppVariantToBool(const CppVariant& value) { | 1125 bool LayoutTestController::CppVariantToBool(const CppVariant& value) { |
| 1115 if (value.isBool()) | 1126 if (value.isBool()) |
| 1116 return value.ToBoolean(); | 1127 return value.ToBoolean(); |
| 1117 else if (value.isInt32()) | 1128 else if (value.isInt32()) |
| 1118 return 0 != value.ToInt32(); | 1129 return 0 != value.ToInt32(); |
| 1119 else if (value.isString()) { | 1130 else if (value.isString()) { |
| 1120 std::string valueString = value.ToString(); | 1131 std::string valueString = value.ToString(); |
| 1121 if (valueString == "true" || valueString == "1") | 1132 if (valueString == "true" || valueString == "1") |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1477 return; | 1488 return; |
| 1478 WebKit::WebDeviceOrientation orientation(args[0].ToBoolean(), | 1489 WebKit::WebDeviceOrientation orientation(args[0].ToBoolean(), |
| 1479 args[1].ToDouble(), | 1490 args[1].ToDouble(), |
| 1480 args[2].ToBoolean(), | 1491 args[2].ToBoolean(), |
| 1481 args[3].ToDouble(), | 1492 args[3].ToDouble(), |
| 1482 args[4].ToBoolean(), | 1493 args[4].ToBoolean(), |
| 1483 args[5].ToDouble()); | 1494 args[5].ToDouble()); |
| 1484 | 1495 |
| 1485 shell_->device_orientation_client_mock()->setOrientation(orientation); | 1496 shell_->device_orientation_client_mock()->setOrientation(orientation); |
| 1486 } | 1497 } |
| OLD | NEW |