OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 | 896 |
897 // Need these conversions because the format of the value for booleans | 897 // Need these conversions because the format of the value for booleans |
898 // may vary - for example, on mac "1" and "0" are used for boolean. | 898 // may vary - for example, on mac "1" and "0" are used for boolean. |
899 bool LayoutTestController::CppVariantToBool(const CppVariant& value) { | 899 bool LayoutTestController::CppVariantToBool(const CppVariant& value) { |
900 if (value.isBool()) | 900 if (value.isBool()) |
901 return value.ToBoolean(); | 901 return value.ToBoolean(); |
902 else if (value.isInt32()) | 902 else if (value.isInt32()) |
903 return 0 != value.ToInt32(); | 903 return 0 != value.ToInt32(); |
904 else if (value.isString()) { | 904 else if (value.isString()) { |
905 std::string valueString = value.ToString(); | 905 std::string valueString = value.ToString(); |
906 if (valueString == "true") | 906 if (valueString == "true" || valueString == "1") |
907 return true; | 907 return true; |
908 if (valueString == "false") | 908 if (valueString == "false" || valueString == "0") |
909 return false; | 909 return false; |
910 } | 910 } |
911 LogErrorToConsole("Invalid value. Expected boolean value."); | 911 LogErrorToConsole("Invalid value. Expected boolean value."); |
912 return false; | 912 return false; |
913 } | 913 } |
914 | 914 |
915 int32 LayoutTestController::CppVariantToInt32(const CppVariant& value) { | 915 int32 LayoutTestController::CppVariantToInt32(const CppVariant& value) { |
916 if (value.isInt32()) | 916 if (value.isInt32()) |
917 return value.ToInt32(); | 917 return value.ToInt32(); |
918 else if (value.isString()) { | 918 else if (value.isString()) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 else if (key == "WebKitUsesPageCachePreferenceKey") | 984 else if (key == "WebKitUsesPageCachePreferenceKey") |
985 preferences->uses_page_cache = CppVariantToBool(value); | 985 preferences->uses_page_cache = CppVariantToBool(value); |
986 else if (key == "WebKitXSSAuditorEnabled") | 986 else if (key == "WebKitXSSAuditorEnabled") |
987 preferences->xss_auditor_enabled = CppVariantToBool(value); | 987 preferences->xss_auditor_enabled = CppVariantToBool(value); |
988 else if (key == "WebKitLocalStorageEnabledPreferenceKey") | 988 else if (key == "WebKitLocalStorageEnabledPreferenceKey") |
989 preferences->local_storage_enabled = CppVariantToBool(value); | 989 preferences->local_storage_enabled = CppVariantToBool(value); |
990 else if (key == "WebKitOfflineWebApplicationCacheEnabled") | 990 else if (key == "WebKitOfflineWebApplicationCacheEnabled") |
991 preferences->application_cache_enabled = CppVariantToBool(value); | 991 preferences->application_cache_enabled = CppVariantToBool(value); |
992 else if (key == "WebKitTabToLinksPreferenceKey") | 992 else if (key == "WebKitTabToLinksPreferenceKey") |
993 preferences->tabs_to_links = CppVariantToBool(value); | 993 preferences->tabs_to_links = CppVariantToBool(value); |
| 994 else if (key == "WebKitWebGLEnabled") |
| 995 preferences->experimental_webgl_enabled = CppVariantToBool(value); |
994 else { | 996 else { |
995 std::string message("Invalid name for preference: "); | 997 std::string message("Invalid name for preference: "); |
996 message.append(key); | 998 message.append(key); |
997 LogErrorToConsole(message); | 999 LogErrorToConsole(message); |
998 } | 1000 } |
999 preferences->Apply(shell_->webView()); | 1001 preferences->Apply(shell_->webView()); |
1000 } | 1002 } |
1001 result->SetNull(); | 1003 result->SetNull(); |
1002 } | 1004 } |
1003 | 1005 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1088 shell_->dev_tools_agent()->evaluateInWebInspector(args[0].ToInt32(), | 1090 shell_->dev_tools_agent()->evaluateInWebInspector(args[0].ToInt32(), |
1089 args[1].ToString()); | 1091 args[1].ToString()); |
1090 } | 1092 } |
1091 | 1093 |
1092 void LayoutTestController::forceRedSelectionColors(const CppArgumentList& args, | 1094 void LayoutTestController::forceRedSelectionColors(const CppArgumentList& args, |
1093 CppVariant* result) { | 1095 CppVariant* result) { |
1094 result->SetNull(); | 1096 result->SetNull(); |
1095 shell_->webView()->setSelectionColors(0xffee0000, 0xff00ee00, 0xff000000, | 1097 shell_->webView()->setSelectionColors(0xffee0000, 0xff00ee00, 0xff000000, |
1096 0xffc0c0c0); | 1098 0xffc0c0c0); |
1097 } | 1099 } |
OLD | NEW |