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

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

Issue 66383005: Remove the concept of user stylesheets. (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
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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 bindMethod("callShouldCloseOnWebView", &TestRunner::callShouldCloseOnWebView ); 185 bindMethod("callShouldCloseOnWebView", &TestRunner::callShouldCloseOnWebView );
186 bindMethod("setDomainRelaxationForbiddenForURLScheme", &TestRunner::setDomai nRelaxationForbiddenForURLScheme); 186 bindMethod("setDomainRelaxationForbiddenForURLScheme", &TestRunner::setDomai nRelaxationForbiddenForURLScheme);
187 bindMethod("evaluateScriptInIsolatedWorldAndReturnValue", &TestRunner::evalu ateScriptInIsolatedWorldAndReturnValue); 187 bindMethod("evaluateScriptInIsolatedWorldAndReturnValue", &TestRunner::evalu ateScriptInIsolatedWorldAndReturnValue);
188 bindMethod("evaluateScriptInIsolatedWorld", &TestRunner::evaluateScriptInIso latedWorld); 188 bindMethod("evaluateScriptInIsolatedWorld", &TestRunner::evaluateScriptInIso latedWorld);
189 bindMethod("setIsolatedWorldSecurityOrigin", &TestRunner::setIsolatedWorldSe curityOrigin); 189 bindMethod("setIsolatedWorldSecurityOrigin", &TestRunner::setIsolatedWorldSe curityOrigin);
190 bindMethod("setIsolatedWorldContentSecurityPolicy", &TestRunner::setIsolated WorldContentSecurityPolicy); 190 bindMethod("setIsolatedWorldContentSecurityPolicy", &TestRunner::setIsolated WorldContentSecurityPolicy);
191 bindMethod("addOriginAccessWhitelistEntry", &TestRunner::addOriginAccessWhit elistEntry); 191 bindMethod("addOriginAccessWhitelistEntry", &TestRunner::addOriginAccessWhit elistEntry);
192 bindMethod("removeOriginAccessWhitelistEntry", &TestRunner::removeOriginAcce ssWhitelistEntry); 192 bindMethod("removeOriginAccessWhitelistEntry", &TestRunner::removeOriginAcce ssWhitelistEntry);
193 bindMethod("hasCustomPageSizeStyle", &TestRunner::hasCustomPageSizeStyle); 193 bindMethod("hasCustomPageSizeStyle", &TestRunner::hasCustomPageSizeStyle);
194 bindMethod("forceRedSelectionColors", &TestRunner::forceRedSelectionColors); 194 bindMethod("forceRedSelectionColors", &TestRunner::forceRedSelectionColors);
195 bindMethod("addUserStyleSheet", &TestRunner::addUserStyleSheet); 195 bindMethod("injectStyleSheet", &TestRunner::injectStyleSheet);
196 bindMethod("startSpeechInput", &TestRunner::startSpeechInput); 196 bindMethod("startSpeechInput", &TestRunner::startSpeechInput);
197 bindMethod("findString", &TestRunner::findString); 197 bindMethod("findString", &TestRunner::findString);
198 bindMethod("setValueForUser", &TestRunner::setValueForUser); 198 bindMethod("setValueForUser", &TestRunner::setValueForUser);
199 bindMethod("selectionAsMarkup", &TestRunner::selectionAsMarkup); 199 bindMethod("selectionAsMarkup", &TestRunner::selectionAsMarkup);
200 bindMethod("setTextSubpixelPositioning", &TestRunner::setTextSubpixelPositio ning); 200 bindMethod("setTextSubpixelPositioning", &TestRunner::setTextSubpixelPositio ning);
201 bindMethod("setPageVisibility", &TestRunner::setPageVisibility); 201 bindMethod("setPageVisibility", &TestRunner::setPageVisibility);
202 bindMethod("setTextDirection", &TestRunner::setTextDirection); 202 bindMethod("setTextDirection", &TestRunner::setTextDirection);
203 bindMethod("textSurroundingNode", &TestRunner::textSurroundingNode); 203 bindMethod("textSurroundingNode", &TestRunner::textSurroundingNode);
204 bindMethod("useUnfortunateSynchronousResizeMode", &TestRunner::useUnfortunat eSynchronousResizeMode); 204 bindMethod("useUnfortunateSynchronousResizeMode", &TestRunner::useUnfortunat eSynchronousResizeMode);
205 bindMethod("disableAutoResizeMode", &TestRunner::disableAutoResizeMode); 205 bindMethod("disableAutoResizeMode", &TestRunner::disableAutoResizeMode);
206 bindMethod("enableAutoResizeMode", &TestRunner::enableAutoResizeMode); 206 bindMethod("enableAutoResizeMode", &TestRunner::enableAutoResizeMode);
207 bindMethod("setMockDeviceMotion", &TestRunner::setMockDeviceMotion); 207 bindMethod("setMockDeviceMotion", &TestRunner::setMockDeviceMotion);
208 bindMethod("setMockDeviceOrientation", &TestRunner::setMockDeviceOrientation ); 208 bindMethod("setMockDeviceOrientation", &TestRunner::setMockDeviceOrientation );
209 bindMethod("didAcquirePointerLock", &TestRunner::didAcquirePointerLock); 209 bindMethod("didAcquirePointerLock", &TestRunner::didAcquirePointerLock);
210 bindMethod("didLosePointerLock", &TestRunner::didLosePointerLock); 210 bindMethod("didLosePointerLock", &TestRunner::didLosePointerLock);
211 bindMethod("didNotAcquirePointerLock", &TestRunner::didNotAcquirePointerLock ); 211 bindMethod("didNotAcquirePointerLock", &TestRunner::didNotAcquirePointerLock );
212 bindMethod("setPointerLockWillRespondAsynchronously", &TestRunner::setPointe rLockWillRespondAsynchronously); 212 bindMethod("setPointerLockWillRespondAsynchronously", &TestRunner::setPointe rLockWillRespondAsynchronously);
213 bindMethod("setPointerLockWillFailSynchronously", &TestRunner::setPointerLoc kWillFailSynchronously); 213 bindMethod("setPointerLockWillFailSynchronously", &TestRunner::setPointerLoc kWillFailSynchronously);
214 214
215 // The following modify WebPreferences. 215 // The following modify WebPreferences.
216 bindMethod("setUserStyleSheetEnabled", &TestRunner::setUserStyleSheetEnabled );
217 bindMethod("setUserStyleSheetLocation", &TestRunner::setUserStyleSheetLocati on);
218 bindMethod("setAuthorAndUserStylesEnabled", &TestRunner::setAuthorAndUserSty lesEnabled); 216 bindMethod("setAuthorAndUserStylesEnabled", &TestRunner::setAuthorAndUserSty lesEnabled);
219 bindMethod("setPopupBlockingEnabled", &TestRunner::setPopupBlockingEnabled); 217 bindMethod("setPopupBlockingEnabled", &TestRunner::setPopupBlockingEnabled);
220 bindMethod("setJavaScriptCanAccessClipboard", &TestRunner::setJavaScriptCanA ccessClipboard); 218 bindMethod("setJavaScriptCanAccessClipboard", &TestRunner::setJavaScriptCanA ccessClipboard);
221 bindMethod("setXSSAuditorEnabled", &TestRunner::setXSSAuditorEnabled); 219 bindMethod("setXSSAuditorEnabled", &TestRunner::setXSSAuditorEnabled);
222 bindMethod("setAllowUniversalAccessFromFileURLs", &TestRunner::setAllowUnive rsalAccessFromFileURLs); 220 bindMethod("setAllowUniversalAccessFromFileURLs", &TestRunner::setAllowUnive rsalAccessFromFileURLs);
223 bindMethod("setAllowFileAccessFromFileURLs", &TestRunner::setAllowFileAccess FromFileURLs); 221 bindMethod("setAllowFileAccessFromFileURLs", &TestRunner::setAllowFileAccess FromFileURLs);
224 bindMethod("overridePreference", &TestRunner::overridePreference); 222 bindMethod("overridePreference", &TestRunner::overridePreference);
225 bindMethod("setPluginsEnabled", &TestRunner::setPluginsEnabled); 223 bindMethod("setPluginsEnabled", &TestRunner::setPluginsEnabled);
226 224
227 // The following modify the state of the TestRunner. 225 // The following modify the state of the TestRunner.
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 423
426 m_httpHeadersToClear.clear(); 424 m_httpHeadersToClear.clear();
427 425
428 m_globalFlag.set(false); 426 m_globalFlag.set(false);
429 m_webHistoryItemCount.set(0); 427 m_webHistoryItemCount.set(0);
430 m_interceptPostMessage.set(false); 428 m_interceptPostMessage.set(false);
431 m_platformName.set("chromium"); 429 m_platformName.set("chromium");
432 m_tooltipText.set(""); 430 m_tooltipText.set("");
433 m_disableNotifyDone.set(false); 431 m_disableNotifyDone.set(false);
434 432
435 m_userStyleSheetLocation = WebURL();
436
437 m_webPermissions->reset(); 433 m_webPermissions->reset();
438 434
439 m_notificationPresenter->reset(); 435 m_notificationPresenter->reset();
440 436
441 m_pointerLocked = false; 437 m_pointerLocked = false;
442 m_pointerLockPlannedResult = PointerLockWillSucceed; 438 m_pointerLockPlannedResult = PointerLockWillSucceed;
443 439
444 m_taskList.revokeAll(); 440 m_taskList.revokeAll();
445 m_workQueue.reset(); 441 m_workQueue.reset();
446 442
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 return; 1288 return;
1293 result->set(frame->hasCustomPageSizeStyle(pageIndex)); 1289 result->set(frame->hasCustomPageSizeStyle(pageIndex));
1294 } 1290 }
1295 1291
1296 void TestRunner::forceRedSelectionColors(const CppArgumentList& arguments, CppVa riant* result) 1292 void TestRunner::forceRedSelectionColors(const CppArgumentList& arguments, CppVa riant* result)
1297 { 1293 {
1298 result->setNull(); 1294 result->setNull();
1299 m_webView->setSelectionColors(0xffee0000, 0xff00ee00, 0xff000000, 0xffc0c0c0 ); 1295 m_webView->setSelectionColors(0xffee0000, 0xff00ee00, 0xff000000, 0xffc0c0c0 );
1300 } 1296 }
1301 1297
1302 void TestRunner::addUserStyleSheet(const CppArgumentList& arguments, CppVariant* result) 1298 void TestRunner::injectStyleSheet(const CppArgumentList& arguments, CppVariant* result)
1303 { 1299 {
1304 result->setNull(); 1300 result->setNull();
1305 if (arguments.size() < 2 || !arguments[0].isString() || !arguments[1].isBool ()) 1301 if (arguments.size() < 2 || !arguments[0].isString() || !arguments[1].isBool ())
1306 return; 1302 return;
1307 WebView::injectStyleSheet( 1303 WebView::injectStyleSheet(
1308 cppVariantToWebString(arguments[0]), WebVector<WebString>(), 1304 cppVariantToWebString(arguments[0]), WebVector<WebString>(),
1309 arguments[1].toBoolean() ? WebView::InjectStyleInAllFrames : WebView::In jectStyleInTopFrameOnly); 1305 arguments[1].toBoolean() ? WebView::InjectStyleInAllFrames : WebView::In jectStyleInTopFrameOnly);
1310 } 1306 }
1311 1307
1312 void TestRunner::startSpeechInput(const CppArgumentList& arguments, CppVariant* result) 1308 void TestRunner::startSpeechInput(const CppArgumentList& arguments, CppVariant* result)
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1573 orientation.hasGamma = arguments[4].toBoolean(); 1569 orientation.hasGamma = arguments[4].toBoolean();
1574 orientation.gamma = arguments[5].toDouble(); 1570 orientation.gamma = arguments[5].toDouble();
1575 1571
1576 // absolute 1572 // absolute
1577 orientation.hasAbsolute = arguments[6].toBoolean(); 1573 orientation.hasAbsolute = arguments[6].toBoolean();
1578 orientation.absolute = arguments[7].toBoolean(); 1574 orientation.absolute = arguments[7].toBoolean();
1579 1575
1580 m_delegate->setDeviceOrientationData(orientation); 1576 m_delegate->setDeviceOrientationData(orientation);
1581 } 1577 }
1582 1578
1583 void TestRunner::setUserStyleSheetEnabled(const CppArgumentList& arguments, CppV ariant* result)
1584 {
1585 if (arguments.size() > 0 && arguments[0].isBool()) {
1586 m_delegate->preferences()->userStyleSheetLocation = arguments[0].value.b oolValue ? m_userStyleSheetLocation : WebURL();
1587 m_delegate->applyPreferences();
1588 }
1589 result->setNull();
1590 }
1591
1592 void TestRunner::setUserStyleSheetLocation(const CppArgumentList& arguments, Cpp Variant* result)
1593 {
1594 if (arguments.size() > 0 && arguments[0].isString()) {
1595 m_userStyleSheetLocation = m_delegate->localFileToDataURL(m_delegate->re writeLayoutTestsURL(arguments[0].toString()));
1596 m_delegate->preferences()->userStyleSheetLocation = m_userStyleSheetLoca tion;
1597 m_delegate->applyPreferences();
1598 }
1599 result->setNull();
1600 }
1601
1602 void TestRunner::setAuthorAndUserStylesEnabled(const CppArgumentList& arguments, CppVariant* result) 1579 void TestRunner::setAuthorAndUserStylesEnabled(const CppArgumentList& arguments, CppVariant* result)
1603 { 1580 {
1604 if (arguments.size() > 0 && arguments[0].isBool()) { 1581 if (arguments.size() > 0 && arguments[0].isBool()) {
1605 m_delegate->preferences()->authorAndUserStylesEnabled = arguments[0].val ue.boolValue; 1582 m_delegate->preferences()->authorAndUserStylesEnabled = arguments[0].val ue.boolValue;
1606 m_delegate->applyPreferences(); 1583 m_delegate->applyPreferences();
1607 } 1584 }
1608 result->setNull(); 1585 result->setNull();
1609 } 1586 }
1610 1587
1611 void TestRunner::setPopupBlockingEnabled(const CppArgumentList& arguments, CppVa riant* result) 1588 void TestRunner::setPopupBlockingEnabled(const CppArgumentList& arguments, CppVa riant* result)
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
2155 result->setNull(); 2132 result->setNull();
2156 } 2133 }
2157 2134
2158 void TestRunner::setPointerLockWillFailSynchronously(const CppArgumentList&, Cpp Variant* result) 2135 void TestRunner::setPointerLockWillFailSynchronously(const CppArgumentList&, Cpp Variant* result)
2159 { 2136 {
2160 m_pointerLockPlannedResult = PointerLockWillFailSync; 2137 m_pointerLockPlannedResult = PointerLockWillFailSync;
2161 result->setNull(); 2138 result->setNull();
2162 } 2139 }
2163 2140
2164 } 2141 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698