Chromium Code Reviews| 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/WebBindings.h" | |
| 18 #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" | 19 #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/WebElement.h" | |
| 19 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" | 22 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" |
| 20 #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationServiceMock.h" | 23 #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationServiceMock.h" |
| 21 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" | 24 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" |
| 22 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" | 25 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" |
| 23 #include "third_party/WebKit/WebKit/chromium/public/WebSecurityPolicy.h" | 26 #include "third_party/WebKit/WebKit/chromium/public/WebSecurityPolicy.h" |
| 24 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" | 27 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" |
| 25 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" | 28 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" |
| 26 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" | 29 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" |
| 27 #include "webkit/glue/dom_operations.h" | 30 #include "webkit/glue/dom_operations.h" |
| 28 #include "webkit/glue/webkit_glue.h" | 31 #include "webkit/glue/webkit_glue.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 BindMethod("setAllowFileAccessFromFileURLs", &LayoutTestController::setAllowFi leAccessFromFileURLs); | 174 BindMethod("setAllowFileAccessFromFileURLs", &LayoutTestController::setAllowFi leAccessFromFileURLs); |
| 172 BindMethod("setJavaScriptProfilingEnabled", &LayoutTestController::setJavaScri ptProfilingEnabled); | 175 BindMethod("setJavaScriptProfilingEnabled", &LayoutTestController::setJavaScri ptProfilingEnabled); |
| 173 BindMethod("setTimelineProfilingEnabled", &LayoutTestController::setTimelinePr ofilingEnabled); | 176 BindMethod("setTimelineProfilingEnabled", &LayoutTestController::setTimelinePr ofilingEnabled); |
| 174 BindMethod("evaluateInWebInspector", &LayoutTestController::evaluateInWebInspe ctor); | 177 BindMethod("evaluateInWebInspector", &LayoutTestController::evaluateInWebInspe ctor); |
| 175 BindMethod("forceRedSelectionColors", &LayoutTestController::forceRedSelection Colors); | 178 BindMethod("forceRedSelectionColors", &LayoutTestController::forceRedSelection Colors); |
| 176 | 179 |
| 177 BindMethod("setGeolocationPermission", &LayoutTestController::setGeolocationPe rmission); | 180 BindMethod("setGeolocationPermission", &LayoutTestController::setGeolocationPe rmission); |
| 178 BindMethod("setMockGeolocationPosition", &LayoutTestController::setMockGeoloca tionPosition); | 181 BindMethod("setMockGeolocationPosition", &LayoutTestController::setMockGeoloca tionPosition); |
| 179 BindMethod("setMockGeolocationError", &LayoutTestController::setMockGeolocatio nError); | 182 BindMethod("setMockGeolocationError", &LayoutTestController::setMockGeolocatio nError); |
| 180 | 183 |
| 184 BindMethod("markerTextForListItem", &LayoutTestController::markerTextForListIt em); | |
| 185 | |
| 181 // The fallback method is called when an unknown method is invoked. | 186 // The fallback method is called when an unknown method is invoked. |
| 182 BindFallbackMethod(&LayoutTestController::fallbackMethod); | 187 BindFallbackMethod(&LayoutTestController::fallbackMethod); |
| 183 | 188 |
| 184 // Shared properties. | 189 // Shared properties. |
| 185 // globalFlag is used by a number of layout tests in | 190 // globalFlag is used by a number of layout tests in |
| 186 // LayoutTests\http\tests\security\dataURL. | 191 // LayoutTests\http\tests\security\dataURL. |
| 187 BindProperty("globalFlag", &globalFlag_); | 192 BindProperty("globalFlag", &globalFlag_); |
| 188 // webHistoryItemCount is used by tests in LayoutTests\http\tests\history | 193 // webHistoryItemCount is used by tests in LayoutTests\http\tests\history |
| 189 BindProperty("webHistoryItemCount", &webHistoryItemCount_); | 194 BindProperty("webHistoryItemCount", &webHistoryItemCount_); |
| 190 } | 195 } |
| (...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1324 } | 1329 } |
| 1325 | 1330 |
| 1326 void LayoutTestController::setMockGeolocationError(const CppArgumentList& args, | 1331 void LayoutTestController::setMockGeolocationError(const CppArgumentList& args, |
| 1327 CppVariant* result) { | 1332 CppVariant* result) { |
| 1328 if (args.size() < 2 || | 1333 if (args.size() < 2 || |
| 1329 !args[0].isInt32() || !args[1].isString()) | 1334 !args[0].isInt32() || !args[1].isString()) |
| 1330 return; | 1335 return; |
| 1331 WebKit::WebGeolocationServiceMock::setMockGeolocationError( | 1336 WebKit::WebGeolocationServiceMock::setMockGeolocationError( |
| 1332 args[0].ToInt32(), WebString::fromUTF8(args[1].ToString())); | 1337 args[0].ToInt32(), WebString::fromUTF8(args[1].ToString())); |
| 1333 } | 1338 } |
| 1339 | |
| 1340 void LayoutTestController::markerTextForListItem(const CppArgumentList& args, | |
| 1341 CppVariant* result) { | |
| 1342 WebKit::WebElement element; | |
|
darin (slow to review)
2010/08/27 03:35:22
nit: I recommend putting 'using WebKit::WebElement
dumi
2010/08/27 03:47:06
done, for all WebKit::X references in this file.
| |
| 1343 if (!WebKit::WebBindings::getElement(args[0].value.objectValue, &element)) | |
| 1344 result->SetNull(); | |
| 1345 else | |
| 1346 result->Set( | |
| 1347 element.document().frame()->markerTextForListItem(element).utf8()); | |
| 1348 } | |
| OLD | NEW |