[chromium] land linux selection color layout test
authortony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Jul 2011 22:13:24 +0000 (22:13 +0000)
committertony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Jul 2011 22:13:24 +0000 (22:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=64631

Reviewed by Ojan Vafai.

Tools:

I had removed this code in r76620 because I thought it wasn't used.
Turns out there was a layout test in the chromium tree that never
got migrated that used it.  Re-add the code and land the layout
test (I will remove it from the chromium tree soon).

* DumpRenderTree/chromium/LayoutTestController.cpp:
(LayoutTestController::LayoutTestController):
(LayoutTestController::forceRedSelectionColors):
* DumpRenderTree/chromium/LayoutTestController.h:

LayoutTests:

* platform/chromium-linux/editing/selection/linux_selection_color.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@91118 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/chromium-linux/editing/selection/linux_selection_color-expected.png [moved from LayoutTests/platform/chromium-linux/linux_selection_color-expected.png with 100% similarity]
LayoutTests/platform/chromium-linux/editing/selection/linux_selection_color-expected.txt [moved from LayoutTests/platform/chromium-linux/linux_selection_color-expected.txt with 100% similarity]
LayoutTests/platform/chromium-linux/editing/selection/linux_selection_color.html [new file with mode: 0644]
Tools/ChangeLog
Tools/DumpRenderTree/chromium/LayoutTestController.cpp
Tools/DumpRenderTree/chromium/LayoutTestController.h

index 6e705ee..f51b90a 100644 (file)
@@ -1,3 +1,12 @@
+2011-07-15  Tony Chang  <tony@chromium.org>
+
+        [chromium] land linux selection color layout test
+        https://bugs.webkit.org/show_bug.cgi?id=64631
+
+        Reviewed by Ojan Vafai.
+
+        * platform/chromium-linux/editing/selection/linux_selection_color.html: Added.
+
 2011-07-15  Vincent Scheib  <scheib@chromium.org>
 
         [chromium] updated test expectations.
diff --git a/LayoutTests/platform/chromium-linux/editing/selection/linux_selection_color.html b/LayoutTests/platform/chromium-linux/editing/selection/linux_selection_color.html
new file mode 100644 (file)
index 0000000..eea9d28
--- /dev/null
@@ -0,0 +1,21 @@
+<html>
+<body>
+<div>
+<p id="text">
+This tests that the methods that set selection colors for Linux work correctly.
+</p>
+<p>(All the text in the above sentence should be highlighted red with green text)</p>
+</div>
+<script>
+if (window.layoutTestController) {
+  layoutTestController.forceRedSelectionColors()
+}
+
+var div = document.getElementById("text");
+var sel = window.getSelection();
+var range = document.createRange();
+range.selectNode(div);
+sel.addRange(range);
+</script>
+</body>
+</html>
index 27bc164..10dda8c 100644 (file)
@@ -1,3 +1,20 @@
+2011-07-15  Tony Chang  <tony@chromium.org>
+
+        [chromium] land linux selection color layout test
+        https://bugs.webkit.org/show_bug.cgi?id=64631
+
+        Reviewed by Ojan Vafai.
+
+        I had removed this code in r76620 because I thought it wasn't used.
+        Turns out there was a layout test in the chromium tree that never
+        got migrated that used it.  Re-add the code and land the layout
+        test (I will remove it from the chromium tree soon).
+
+        * DumpRenderTree/chromium/LayoutTestController.cpp:
+        (LayoutTestController::LayoutTestController):
+        (LayoutTestController::forceRedSelectionColors):
+        * DumpRenderTree/chromium/LayoutTestController.h:
+
 2011-07-15  Dimitri Glazkov  <dglazkov@chromium.org>
 
         Revert http://trac.webkit.org/changeset/91091, since Python 2.5
index 89ebfdf..8576d53 100644 (file)
@@ -112,6 +112,7 @@ LayoutTestController::LayoutTestController(TestShell* shell)
     bindMethod("evaluateScriptInIsolatedWorld", &LayoutTestController::evaluateScriptInIsolatedWorld);
     bindMethod("setIsolatedWorldSecurityOrigin", &LayoutTestController::setIsolatedWorldSecurityOrigin);
     bindMethod("execCommand", &LayoutTestController::execCommand);
+    bindMethod("forceRedSelectionColors", &LayoutTestController::forceRedSelectionColors);
     bindMethod("grantDesktopNotificationPermission", &LayoutTestController::grantDesktopNotificationPermission);
     bindMethod("hasSpellingMarker", &LayoutTestController::hasSpellingMarker);
     bindMethod("isCommandEnabled", &LayoutTestController::isCommandEnabled);
@@ -1599,6 +1600,12 @@ void LayoutTestController::evaluateInWebInspector(const CppArgumentList& argumen
     m_shell->drtDevToolsAgent()->evaluateInWebInspector(arguments[0].toInt32(), arguments[1].toString());
 }
 
+void LayoutTestController::forceRedSelectionColors(const CppArgumentList& arguments, CppVariant* result)
+{
+    result->setNull();
+    m_shell->webView()->setSelectionColors(0xffee0000, 0xff00ee00, 0xff000000, 0xffc0c0c0);
+}
+
 void LayoutTestController::addUserScript(const CppArgumentList& arguments, CppVariant* result)
 {
     result->setNull();
index 5542595..3a7b1f2 100644 (file)
@@ -334,6 +334,9 @@ public:
     // Allows layout tests to exec scripts at WebInspector side.
     void evaluateInWebInspector(const CppArgumentList&, CppVariant*);
 
+    // Forces the selection colors for testing under Linux.
+    void forceRedSelectionColors(const CppArgumentList&, CppVariant*);
+
     // Adds a user script or user style sheet to be injected into new documents.
     void addUserScript(const CppArgumentList&, CppVariant*);
     void addUserStyleSheet(const CppArgumentList&, CppVariant*);