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 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1398 void LayoutTestController::forceRedSelectionColors(const CppArgumentList& args, | 1398 void LayoutTestController::forceRedSelectionColors(const CppArgumentList& args, |
1399 CppVariant* result) { | 1399 CppVariant* result) { |
1400 result->SetNull(); | 1400 result->SetNull(); |
1401 shell_->webView()->setSelectionColors(0xffee0000, 0xff00ee00, 0xff000000, | 1401 shell_->webView()->setSelectionColors(0xffee0000, 0xff00ee00, 0xff000000, |
1402 0xffc0c0c0); | 1402 0xffc0c0c0); |
1403 } | 1403 } |
1404 | 1404 |
1405 void LayoutTestController::addUserScript(const CppArgumentList& args, | 1405 void LayoutTestController::addUserScript(const CppArgumentList& args, |
1406 CppVariant* result) { | 1406 CppVariant* result) { |
1407 result->SetNull(); | 1407 result->SetNull(); |
1408 if (args.size() < 2 || !args[0].isString() || !args[1].isBool()) | 1408 if (args.size() < 3 || !args[0].isString() || !args[1].isBool() || |
| 1409 !args[2].isBool()) |
1409 return; | 1410 return; |
1410 shell_->webView()->addUserScript(WebString::fromUTF8(args[0].ToString()), | 1411 WebKit::WebView::addUserScript( |
1411 args[1].ToBoolean()); | 1412 WebString::fromUTF8(args[0].ToString()), |
| 1413 WebKit::WebVector<WebString>(), |
| 1414 args[1].ToBoolean() ? |
| 1415 WebKit::WebView::UserScriptInjectAtDocumentStart : |
| 1416 WebKit::WebView::UserScriptInjectAtDocumentEnd, |
| 1417 args[2].ToBoolean() ? |
| 1418 WebKit::WebView::UserContentInjectInAllFrames : |
| 1419 WebKit::WebView::UserContentInjectInTopFrameOnly); |
1412 } | 1420 } |
1413 | 1421 |
1414 void LayoutTestController::addUserStyleSheet(const CppArgumentList& args, | 1422 void LayoutTestController::addUserStyleSheet(const CppArgumentList& args, |
1415 CppVariant* result) { | 1423 CppVariant* result) { |
1416 result->SetNull(); | 1424 result->SetNull(); |
1417 if (args.size() < 1 || !args[0].isString()) | 1425 if (args.size() < 2 || !args[0].isString() || !args[1].isBool()) |
1418 return; | 1426 return; |
1419 shell_->webView()->addUserStyleSheet(WebString::fromUTF8(args[0].ToString())); | 1427 WebKit::WebView::addUserStyleSheet( |
| 1428 WebString::fromUTF8(args[0].ToString()), |
| 1429 WebKit::WebVector<WebString>(), |
| 1430 args[1].ToBoolean() ? |
| 1431 WebKit::WebView::UserContentInjectInAllFrames : |
| 1432 WebKit::WebView::UserContentInjectInTopFrameOnly, |
| 1433 WebKit::WebView::UserStyleInjectInExistingDocuments); |
1420 } | 1434 } |
1421 | 1435 |
1422 void LayoutTestController::setEditingBehavior(const CppArgumentList& args, | 1436 void LayoutTestController::setEditingBehavior(const CppArgumentList& args, |
1423 CppVariant* result) { | 1437 CppVariant* result) { |
1424 result->SetNull(); | 1438 result->SetNull(); |
1425 WebString key = WebString::fromUTF8(args[0].ToString()); | 1439 WebString key = WebString::fromUTF8(args[0].ToString()); |
1426 if (key == "mac") { | 1440 if (key == "mac") { |
1427 shell_->webView()->settings()->setEditingBehavior( | 1441 shell_->webView()->settings()->setEditingBehavior( |
1428 WebKit::WebSettings::EditingBehaviorMac); | 1442 WebKit::WebSettings::EditingBehaviorMac); |
1429 } else if (key == "win") { | 1443 } else if (key == "win") { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1479 return; | 1493 return; |
1480 WebKit::WebDeviceOrientation orientation(args[0].ToBoolean(), | 1494 WebKit::WebDeviceOrientation orientation(args[0].ToBoolean(), |
1481 args[1].ToDouble(), | 1495 args[1].ToDouble(), |
1482 args[2].ToBoolean(), | 1496 args[2].ToBoolean(), |
1483 args[3].ToDouble(), | 1497 args[3].ToDouble(), |
1484 args[4].ToBoolean(), | 1498 args[4].ToBoolean(), |
1485 args[5].ToDouble()); | 1499 args[5].ToDouble()); |
1486 | 1500 |
1487 shell_->device_orientation_client_mock()->setOrientation(orientation); | 1501 shell_->device_orientation_client_mock()->setOrientation(orientation); |
1488 } | 1502 } |
OLD | NEW |