Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(477)

Side by Side Diff: Source/testing/runner/TestRunner.cpp

Issue 61773005: Rename WebKit namespace to blink (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/testing/runner/TestRunner.h ('k') | Source/testing/runner/TextInputController.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2010 Pawel Hajdan (phajdan.jr@chromium.org) 3 * Copyright (C) 2010 Pawel Hajdan (phajdan.jr@chromium.org)
4 * Copyright (C) 2012 Apple Inc. All Rights Reserved. 4 * Copyright (C) 2012 Apple Inc. All Rights Reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are 7 * modification, are permitted provided that the following conditions are
8 * met: 8 * met:
9 * 9 *
10 * * Redistributions of source code must retain the above copyright 10 * * Redistributions of source code must retain the above copyright
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 #include "public/web/WebSurroundingText.h" 62 #include "public/web/WebSurroundingText.h"
63 #include "public/web/WebView.h" 63 #include "public/web/WebView.h"
64 #include "v8/include/v8.h" 64 #include "v8/include/v8.h"
65 #include <limits> 65 #include <limits>
66 #include <memory> 66 #include <memory>
67 67
68 #if defined(__linux__) || defined(ANDROID) 68 #if defined(__linux__) || defined(ANDROID)
69 #include "public/web/linux/WebFontRendering.h" 69 #include "public/web/linux/WebFontRendering.h"
70 #endif 70 #endif
71 71
72 using namespace WebKit; 72 using namespace blink;
73 using namespace std; 73 using namespace std;
74 74
75 namespace WebTestRunner { 75 namespace WebTestRunner {
76 76
77 namespace { 77 namespace {
78 78
79 class InvokeCallbackTask : public WebMethodTask<TestRunner> { 79 class InvokeCallbackTask : public WebMethodTask<TestRunner> {
80 public: 80 public:
81 InvokeCallbackTask(TestRunner* object, auto_ptr<CppVariant> callbackArgument s) 81 InvokeCallbackTask(TestRunner* object, auto_ptr<CppVariant> callbackArgument s)
82 : WebMethodTask<TestRunner>(object) 82 : WebMethodTask<TestRunner>(object)
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 void TestRunner::requestPointerUnlock() 722 void TestRunner::requestPointerUnlock()
723 { 723 {
724 m_delegate->postDelayedTask(new HostMethodTask(this, &TestRunner::didLosePoi nterLockInternal), 0); 724 m_delegate->postDelayedTask(new HostMethodTask(this, &TestRunner::didLosePoi nterLockInternal), 0);
725 } 725 }
726 726
727 bool TestRunner::isPointerLocked() 727 bool TestRunner::isPointerLocked()
728 { 728 {
729 return m_pointerLocked; 729 return m_pointerLocked;
730 } 730 }
731 731
732 void TestRunner::setToolTipText(const WebKit::WebString& text) 732 void TestRunner::setToolTipText(const blink::WebString& text)
733 { 733 {
734 m_tooltipText.set(text.utf8()); 734 m_tooltipText.set(text.utf8());
735 } 735 }
736 736
737 bool TestRunner::midiAccessorResult() 737 bool TestRunner::midiAccessorResult()
738 { 738 {
739 return m_midiAccessorResult; 739 return m_midiAccessorResult;
740 } 740 }
741 741
742 TestRunner::TestPageOverlay::TestPageOverlay(WebKit::WebView* webView) : m_webVi ew(webView) 742 TestRunner::TestPageOverlay::TestPageOverlay(blink::WebView* webView) : m_webVie w(webView)
743 { 743 {
744 } 744 }
745 745
746 TestRunner::TestPageOverlay::~TestPageOverlay() 746 TestRunner::TestPageOverlay::~TestPageOverlay()
747 { 747 {
748 } 748 }
749 749
750 void TestRunner::TestPageOverlay::paintPageOverlay(WebKit::WebCanvas* canvas) 750 void TestRunner::TestPageOverlay::paintPageOverlay(blink::WebCanvas* canvas)
751 { 751 {
752 SkRect rect = SkRect::MakeWH(m_webView->size().width, m_webView->size().heig ht); 752 SkRect rect = SkRect::MakeWH(m_webView->size().width, m_webView->size().heig ht);
753 SkPaint paint; 753 SkPaint paint;
754 paint.setColor(SK_ColorCYAN); 754 paint.setColor(SK_ColorCYAN);
755 paint.setStyle(SkPaint::kFill_Style); 755 paint.setStyle(SkPaint::kFill_Style);
756 canvas->drawRect(rect, paint); 756 canvas->drawRect(rect, paint);
757 } 757 }
758 758
759 void TestRunner::didAcquirePointerLockInternal() 759 void TestRunner::didAcquirePointerLockInternal()
760 { 760 {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 WorkItemLoadHTMLString(const std::string& html, const WebURL& baseURL) 932 WorkItemLoadHTMLString(const std::string& html, const WebURL& baseURL)
933 : m_html(html) 933 : m_html(html)
934 , m_baseURL(baseURL) { } 934 , m_baseURL(baseURL) { }
935 WorkItemLoadHTMLString(const std::string& html, const WebURL& baseURL, const WebURL& unreachableURL) 935 WorkItemLoadHTMLString(const std::string& html, const WebURL& baseURL, const WebURL& unreachableURL)
936 : m_html(html) 936 : m_html(html)
937 , m_baseURL(baseURL) 937 , m_baseURL(baseURL)
938 , m_unreachableURL(unreachableURL) { } 938 , m_unreachableURL(unreachableURL) { }
939 bool run(WebTestDelegate*, WebView* webView) 939 bool run(WebTestDelegate*, WebView* webView)
940 { 940 {
941 webView->mainFrame()->loadHTMLString( 941 webView->mainFrame()->loadHTMLString(
942 WebKit::WebData(m_html.data(), m_html.length()), m_baseURL, m_unreac hableURL); 942 blink::WebData(m_html.data(), m_html.length()), m_baseURL, m_unreach ableURL);
943 return true; 943 return true;
944 } 944 }
945 945
946 private: 946 private:
947 std::string m_html; 947 std::string m_html;
948 WebURL m_baseURL; 948 WebURL m_baseURL;
949 WebURL m_unreachableURL; 949 WebURL m_unreachableURL;
950 }; 950 };
951 951
952 void TestRunner::queueLoadHTMLString(const CppArgumentList& arguments, CppVarian t* result) 952 void TestRunner::queueLoadHTMLString(const CppArgumentList& arguments, CppVarian t* result)
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 } 1242 }
1243 1243
1244 void TestRunner::addOriginAccessWhitelistEntry(const CppArgumentList& arguments, CppVariant* result) 1244 void TestRunner::addOriginAccessWhitelistEntry(const CppArgumentList& arguments, CppVariant* result)
1245 { 1245 {
1246 result->setNull(); 1246 result->setNull();
1247 1247
1248 if (arguments.size() != 4 || !arguments[0].isString() || !arguments[1].isStr ing() 1248 if (arguments.size() != 4 || !arguments[0].isString() || !arguments[1].isStr ing()
1249 || !arguments[2].isString() || !arguments[3].isBool()) 1249 || !arguments[2].isString() || !arguments[3].isBool())
1250 return; 1250 return;
1251 1251
1252 WebKit::WebURL url(GURL(arguments[0].toString())); 1252 blink::WebURL url(GURL(arguments[0].toString()));
1253 if (!url.isValid()) 1253 if (!url.isValid())
1254 return; 1254 return;
1255 1255
1256 WebSecurityPolicy::addOriginAccessWhitelistEntry( 1256 WebSecurityPolicy::addOriginAccessWhitelistEntry(
1257 url, 1257 url,
1258 cppVariantToWebString(arguments[1]), 1258 cppVariantToWebString(arguments[1]),
1259 cppVariantToWebString(arguments[2]), 1259 cppVariantToWebString(arguments[2]),
1260 arguments[3].toBoolean()); 1260 arguments[3].toBoolean());
1261 } 1261 }
1262 1262
1263 void TestRunner::removeOriginAccessWhitelistEntry(const CppArgumentList& argumen ts, CppVariant* result) 1263 void TestRunner::removeOriginAccessWhitelistEntry(const CppArgumentList& argumen ts, CppVariant* result)
1264 { 1264 {
1265 result->setNull(); 1265 result->setNull();
1266 1266
1267 if (arguments.size() != 4 || !arguments[0].isString() || !arguments[1].isStr ing() 1267 if (arguments.size() != 4 || !arguments[0].isString() || !arguments[1].isStr ing()
1268 || !arguments[2].isString() || !arguments[3].isBool()) 1268 || !arguments[2].isString() || !arguments[3].isBool())
1269 return; 1269 return;
1270 1270
1271 WebKit::WebURL url(GURL(arguments[0].toString())); 1271 blink::WebURL url(GURL(arguments[0].toString()));
1272 if (!url.isValid()) 1272 if (!url.isValid())
1273 return; 1273 return;
1274 1274
1275 WebSecurityPolicy::removeOriginAccessWhitelistEntry( 1275 WebSecurityPolicy::removeOriginAccessWhitelistEntry(
1276 url, 1276 url,
1277 cppVariantToWebString(arguments[1]), 1277 cppVariantToWebString(arguments[1]),
1278 cppVariantToWebString(arguments[2]), 1278 cppVariantToWebString(arguments[2]),
1279 arguments[3].toBoolean()); 1279 arguments[3].toBoolean());
1280 } 1280 }
1281 1281
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 } 1413 }
1414 1414
1415 void TestRunner::setTextDirection(const CppArgumentList& arguments, CppVariant* result) 1415 void TestRunner::setTextDirection(const CppArgumentList& arguments, CppVariant* result)
1416 { 1416 {
1417 result->setNull(); 1417 result->setNull();
1418 if (arguments.size() != 1 || !arguments[0].isString()) 1418 if (arguments.size() != 1 || !arguments[0].isString())
1419 return; 1419 return;
1420 1420
1421 // Map a direction name to a WebTextDirection value. 1421 // Map a direction name to a WebTextDirection value.
1422 std::string directionName = arguments[0].toString(); 1422 std::string directionName = arguments[0].toString();
1423 WebKit::WebTextDirection direction; 1423 blink::WebTextDirection direction;
1424 if (directionName == "auto") 1424 if (directionName == "auto")
1425 direction = WebKit::WebTextDirectionDefault; 1425 direction = blink::WebTextDirectionDefault;
1426 else if (directionName == "rtl") 1426 else if (directionName == "rtl")
1427 direction = WebKit::WebTextDirectionRightToLeft; 1427 direction = blink::WebTextDirectionRightToLeft;
1428 else if (directionName == "ltr") 1428 else if (directionName == "ltr")
1429 direction = WebKit::WebTextDirectionLeftToRight; 1429 direction = blink::WebTextDirectionLeftToRight;
1430 else 1430 else
1431 return; 1431 return;
1432 1432
1433 m_webView->setTextDirection(direction); 1433 m_webView->setTextDirection(direction);
1434 } 1434 }
1435 1435
1436 void TestRunner::textSurroundingNode(const CppArgumentList& arguments, CppVarian t* result) 1436 void TestRunner::textSurroundingNode(const CppArgumentList& arguments, CppVarian t* result)
1437 { 1437 {
1438 result->setNull(); 1438 result->setNull();
1439 if (arguments.size() < 4 || !arguments[0].isObject() || !arguments[1].isNumb er() || !arguments[2].isNumber() || !arguments[3].isNumber()) 1439 if (arguments.size() < 4 || !arguments[0].isObject() || !arguments[1].isNumb er() || !arguments[2].isNumber() || !arguments[3].isNumber())
(...skipping 30 matching lines...) Expand all
1470 } 1470 }
1471 1471
1472 void TestRunner::enableAutoResizeMode(const CppArgumentList& arguments, CppVaria nt* result) 1472 void TestRunner::enableAutoResizeMode(const CppArgumentList& arguments, CppVaria nt* result)
1473 { 1473 {
1474 if (arguments.size() != 4) { 1474 if (arguments.size() != 4) {
1475 result->set(false); 1475 result->set(false);
1476 return; 1476 return;
1477 } 1477 }
1478 int minWidth = cppVariantToInt32(arguments[0]); 1478 int minWidth = cppVariantToInt32(arguments[0]);
1479 int minHeight = cppVariantToInt32(arguments[1]); 1479 int minHeight = cppVariantToInt32(arguments[1]);
1480 WebKit::WebSize minSize(minWidth, minHeight); 1480 blink::WebSize minSize(minWidth, minHeight);
1481 1481
1482 int maxWidth = cppVariantToInt32(arguments[2]); 1482 int maxWidth = cppVariantToInt32(arguments[2]);
1483 int maxHeight = cppVariantToInt32(arguments[3]); 1483 int maxHeight = cppVariantToInt32(arguments[3]);
1484 WebKit::WebSize maxSize(maxWidth, maxHeight); 1484 blink::WebSize maxSize(maxWidth, maxHeight);
1485 1485
1486 m_delegate->enableAutoResizeMode(minSize, maxSize); 1486 m_delegate->enableAutoResizeMode(minSize, maxSize);
1487 result->set(true); 1487 result->set(true);
1488 } 1488 }
1489 1489
1490 void TestRunner::disableAutoResizeMode(const CppArgumentList& arguments, CppVari ant* result) 1490 void TestRunner::disableAutoResizeMode(const CppArgumentList& arguments, CppVari ant* result)
1491 { 1491 {
1492 if (arguments.size() !=2) { 1492 if (arguments.size() !=2) {
1493 result->set(false); 1493 result->set(false);
1494 return; 1494 return;
1495 } 1495 }
1496 int newWidth = cppVariantToInt32(arguments[0]); 1496 int newWidth = cppVariantToInt32(arguments[0]);
1497 int newHeight = cppVariantToInt32(arguments[1]); 1497 int newHeight = cppVariantToInt32(arguments[1]);
1498 WebKit::WebSize newSize(newWidth, newHeight); 1498 blink::WebSize newSize(newWidth, newHeight);
1499 1499
1500 m_delegate->disableAutoResizeMode(newSize); 1500 m_delegate->disableAutoResizeMode(newSize);
1501 result->set(true); 1501 result->set(true);
1502 } 1502 }
1503 1503
1504 void TestRunner::setMockDeviceMotion(const CppArgumentList& arguments, CppVarian t* result) 1504 void TestRunner::setMockDeviceMotion(const CppArgumentList& arguments, CppVarian t* result)
1505 { 1505 {
1506 result->setNull(); 1506 result->setNull();
1507 if (arguments.size() < 19 1507 if (arguments.size() < 19
1508 || !arguments[0].isBool() || !arguments[1].isNumber() // acceleration.x 1508 || !arguments[0].isBool() || !arguments[1].isNumber() // acceleration.x
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
2155 result->setNull(); 2155 result->setNull();
2156 } 2156 }
2157 2157
2158 void TestRunner::setPointerLockWillFailSynchronously(const CppArgumentList&, Cpp Variant* result) 2158 void TestRunner::setPointerLockWillFailSynchronously(const CppArgumentList&, Cpp Variant* result)
2159 { 2159 {
2160 m_pointerLockPlannedResult = PointerLockWillFailSync; 2160 m_pointerLockPlannedResult = PointerLockWillFailSync;
2161 result->setNull(); 2161 result->setNull();
2162 } 2162 }
2163 2163
2164 } 2164 }
OLDNEW
« no previous file with comments | « Source/testing/runner/TestRunner.h ('k') | Source/testing/runner/TextInputController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698