| 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 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 if (args.size() > 0 && args[0].isBool()) { | 1121 if (args.size() > 0 && args[0].isBool()) { |
| 1122 WebPreferences* prefs = shell_->GetWebPreferences(); | 1122 WebPreferences* prefs = shell_->GetWebPreferences(); |
| 1123 prefs->allow_file_access_from_file_urls = args[0].value.boolValue; | 1123 prefs->allow_file_access_from_file_urls = args[0].value.boolValue; |
| 1124 prefs->Apply(shell_->webView()); | 1124 prefs->Apply(shell_->webView()); |
| 1125 } | 1125 } |
| 1126 result->SetNull(); | 1126 result->SetNull(); |
| 1127 } | 1127 } |
| 1128 | 1128 |
| 1129 void LayoutTestController::setMockSpeechInputResult(const CppArgumentList& args, | 1129 void LayoutTestController::setMockSpeechInputResult(const CppArgumentList& args, |
| 1130 CppVariant* result) { | 1130 CppVariant* result) { |
| 1131 if (args.size() > 0 && args[0].isString()) { | 1131 if (args.size() > 0 && args[0].isString() && args[1].isString()) { |
| 1132 shell_->speech_input_controller_mock()->setMockRecognitionResult( | 1132 shell_->speech_input_controller_mock()->setMockRecognitionResult( |
| 1133 WebString::fromUTF8(args[0].ToString())); | 1133 WebString::fromUTF8(args[0].ToString()), |
| 1134 WebString::fromUTF8(args[1].ToString())); |
| 1134 } | 1135 } |
| 1135 result->SetNull(); | 1136 result->SetNull(); |
| 1136 } | 1137 } |
| 1137 | 1138 |
| 1138 // Need these conversions because the format of the value for booleans | 1139 // Need these conversions because the format of the value for booleans |
| 1139 // may vary - for example, on mac "1" and "0" are used for boolean. | 1140 // may vary - for example, on mac "1" and "0" are used for boolean. |
| 1140 bool LayoutTestController::CppVariantToBool(const CppVariant& value) { | 1141 bool LayoutTestController::CppVariantToBool(const CppVariant& value) { |
| 1141 if (value.isBool()) | 1142 if (value.isBool()) |
| 1142 return value.ToBoolean(); | 1143 return value.ToBoolean(); |
| 1143 else if (value.isInt32()) | 1144 else if (value.isInt32()) |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1529 shell_->device_orientation_client_mock()->setOrientation(orientation); | 1530 shell_->device_orientation_client_mock()->setOrientation(orientation); |
| 1530 } | 1531 } |
| 1531 | 1532 |
| 1532 void LayoutTestController::hasSpellingMarker(const CppArgumentList& arguments, | 1533 void LayoutTestController::hasSpellingMarker(const CppArgumentList& arguments, |
| 1533 CppVariant* result) { | 1534 CppVariant* result) { |
| 1534 if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isNumber
()) | 1535 if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isNumber
()) |
| 1535 return; | 1536 return; |
| 1536 result->Set(shell_->webView()->mainFrame()->selectionStartHasSpellingMarkerFor
( | 1537 result->Set(shell_->webView()->mainFrame()->selectionStartHasSpellingMarkerFor
( |
| 1537 arguments[0].ToInt32(), arguments[1].ToInt32())); | 1538 arguments[0].ToInt32(), arguments[1].ToInt32())); |
| 1538 } | 1539 } |
| OLD | NEW |