[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

steveblock at google.com steveblock at google.com
Wed Dec 22 11:33:29 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 47068b30681eff0d39f43e97f9299a186c0c5475
Author: steveblock at google.com <steveblock at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jul 29 11:41:34 2010 +0000

    2010-07-29  Steve Block  <steveblock at google.com>
    
            Reviewed by Jeremy Orlow.
    
            Add LayoutTestController methods to test DeviceOrientation
            https://bugs.webkit.org/show_bug.cgi?id=39589
    
            * fast/dom/DeviceOrientation/basic-operation-expected.txt: Added.
            * fast/dom/DeviceOrientation/basic-operation.html: Added.
            * fast/dom/DeviceOrientation/script-tests/basic-operation.js: Added.
            * platform/gtk/Skipped:
    2010-07-29  Steve Block  <steveblock at google.com>
    
            Reviewed by Jeremy Orlow.
    
            Add LayoutTestController methods to test DeviceOrientation
            https://bugs.webkit.org/show_bug.cgi?id=39589
    
            This patch does not hook up the new LayoutTestController method to WebKit
            for any platform. This will be done in later patches.
            https://bugs.webkit.org/show_bug.cgi?id=43181 tracks this for Mac.
    
            Test: fast/dom/DeviceOrientation/basic-operation.html
    
            * WebCore/WebCore.exp.in:
            * WebCore.xcodeproj/project.pbxproj:
            * dom/DeviceOrientationClient.h:
            (WebCore::DeviceOrientationClient::~DeviceOrientationClient):
            * dom/DeviceOrientationController.cpp:
            (WebCore::DeviceOrientationController::DeviceOrientationController):
            * dom/DeviceOrientationEvent.cpp:
            * platform/mock/DeviceOrientationClientMock.cpp: Added.
            (WebCore::DeviceOrientationClientMock::DeviceOrientationClientMock):
            (WebCore::DeviceOrientationClientMock::setController):
            (WebCore::DeviceOrientationClientMock::startUpdating):
            (WebCore::DeviceOrientationClientMock::stopUpdating):
            (WebCore::DeviceOrientationClientMock::setOrientation):
            (WebCore::DeviceOrientationClientMock::timerFired):
            * platform/mock/DeviceOrientationClientMock.h: Added.
            (WebCore::DeviceOrientationClientMock::lastOrientation):
    2010-07-29  Steve Block  <steveblock at google.com>
    
            Reviewed by Jeremy Orlow.
    
            Add LayoutTestController methods to test DeviceOrientation
            https://bugs.webkit.org/show_bug.cgi?id=39589
    
            * DumpRenderTree/LayoutTestController.cpp:
            (setMockDeviceOrientationCallback):
            (LayoutTestController::staticFunctions):
            * DumpRenderTree/LayoutTestController.h:
            * DumpRenderTree/chromium/LayoutTestController.cpp:
            * DumpRenderTree/chromium/LayoutTestController.h:
            * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
            (LayoutTestController::setMockDeviceOrientation):
            * DumpRenderTree/mac/LayoutTestControllerMac.mm:
            (LayoutTestController::setMockDeviceOrientation):
            * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
            (LayoutTestController::setMockDeviceOrientation):
            * DumpRenderTree/qt/LayoutTestControllerQt.h:
            * DumpRenderTree/win/LayoutTestControllerWin.cpp:
            (LayoutTestController::setMockDeviceOrientation):
            * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
            (LayoutTestController::setMockDeviceOrientation):
            * Scripts/build-webkit:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64270 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index b2db337..8824beb 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-07-29  Steve Block  <steveblock at google.com>
+
+        Reviewed by Jeremy Orlow.
+
+        Add LayoutTestController methods to test DeviceOrientation
+        https://bugs.webkit.org/show_bug.cgi?id=39589
+
+        * fast/dom/DeviceOrientation/basic-operation-expected.txt: Added.
+        * fast/dom/DeviceOrientation/basic-operation.html: Added.
+        * fast/dom/DeviceOrientation/script-tests/basic-operation.js: Added.
+        * platform/gtk/Skipped:
+
 2010-07-29  Jeremy Orlow  <jorlow at chromium.org>
 
         http://trac.webkit.org/changeset/64266 and its parents missed one
diff --git a/LayoutTests/fast/dom/DeviceOrientation/basic-operation-expected.txt b/LayoutTests/fast/dom/DeviceOrientation/basic-operation-expected.txt
new file mode 100644
index 0000000..48dc123
--- /dev/null
+++ b/LayoutTests/fast/dom/DeviceOrientation/basic-operation-expected.txt
@@ -0,0 +1,12 @@
+Tests the basic operation of DeviceOrientation using the mock.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS deviceOrientationEvent.alpha is mockAlpha
+PASS deviceOrientationEvent.beta is mockBeta
+PASS deviceOrientationEvent.gamma is mockGamma
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/DeviceOrientation/basic-operation.html b/LayoutTests/fast/dom/DeviceOrientation/basic-operation.html
new file mode 100644
index 0000000..4bc77ce
--- /dev/null
+++ b/LayoutTests/fast/dom/DeviceOrientation/basic-operation.html
@@ -0,0 +1,12 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/basic-operation.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/basic-operation.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/basic-operation.js
new file mode 100644
index 0000000..6e68b06
--- /dev/null
+++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/basic-operation.js
@@ -0,0 +1,22 @@
+description("Tests the basic operation of DeviceOrientation using the mock.");
+
+var mockAlpha = 1.1;
+var mockBeta = 2.2;
+var mockGamma = 3.3;
+
+if (window.layoutTestController)
+    layoutTestController.setMockDeviceOrientation(true, mockAlpha, true, mockBeta, true, mockGamma);
+else
+    debug('This test can not be run without the LayoutTestController');
+
+var deviceOrientationEvent;
+window.addEventListener("deviceorientation", function(e) {
+    deviceOrientationEvent = e;
+    shouldBe('deviceOrientationEvent.alpha', 'mockAlpha');
+    shouldBe('deviceOrientationEvent.beta', 'mockBeta');
+    shouldBe('deviceOrientationEvent.gamma', 'mockGamma');
+    finishJSTest();
+});
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index 3896f8b..89e7158 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -1091,6 +1091,7 @@ fast/dom/client-width-height-quirks.html
 fast/dom/client-width-height.html
 fast/dom/cssTarget-crash.html
 fast/dom/frame-loading-via-document-write.html
+fast/dom/DeviceOrientation/basic-operation.html
 fast/dom/DeviceOrientation/create-event.html
 fast/dom/DeviceOrientation/optional-event-properties.html
 fast/dom/DeviceOrientation/window-property.html
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index df737f4..9479840 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,33 @@
+2010-07-29  Steve Block  <steveblock at google.com>
+
+        Reviewed by Jeremy Orlow.
+
+        Add LayoutTestController methods to test DeviceOrientation
+        https://bugs.webkit.org/show_bug.cgi?id=39589
+
+        This patch does not hook up the new LayoutTestController method to WebKit
+        for any platform. This will be done in later patches.
+        https://bugs.webkit.org/show_bug.cgi?id=43181 tracks this for Mac.
+
+        Test: fast/dom/DeviceOrientation/basic-operation.html
+
+        * WebCore/WebCore.exp.in:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/DeviceOrientationClient.h:
+        (WebCore::DeviceOrientationClient::~DeviceOrientationClient):
+        * dom/DeviceOrientationController.cpp:
+        (WebCore::DeviceOrientationController::DeviceOrientationController):
+        * dom/DeviceOrientationEvent.cpp:
+        * platform/mock/DeviceOrientationClientMock.cpp: Added.
+        (WebCore::DeviceOrientationClientMock::DeviceOrientationClientMock):
+        (WebCore::DeviceOrientationClientMock::setController):
+        (WebCore::DeviceOrientationClientMock::startUpdating):
+        (WebCore::DeviceOrientationClientMock::stopUpdating):
+        (WebCore::DeviceOrientationClientMock::setOrientation):
+        (WebCore::DeviceOrientationClientMock::timerFired):
+        * platform/mock/DeviceOrientationClientMock.h: Added.
+        (WebCore::DeviceOrientationClientMock::lastOrientation):
+
 2010-07-29  Satish Sampath  <satish at chromium.org>
 
         Reviewed by Steve Block.
diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in
index c1079d5..70e4aa3 100644
--- a/WebCore/WebCore.exp.in
+++ b/WebCore/WebCore.exp.in
@@ -402,6 +402,7 @@ __ZN7WebCore16isEndOfParagraphERKNS_15VisiblePositionE
 __ZN7WebCore16jsStringSlowCaseEPN3JSC9ExecStateERNS0_9WeakGCMapIPNS_10StringImplEPNS0_8JSStringEEES5_
 __ZN7WebCore17CredentialStorage3getERKNS_15ProtectionSpaceE
 __ZN7WebCore17DOMImplementation14isTextMIMETypeERKNS_6StringE
+__ZN7WebCore17DeviceOrientation6createEbdbdbd
 __ZN7WebCore17GlyphPageTreeNode18treeGlyphPageCountEv
 __ZN7WebCore17HTMLPlugInElement11getNPObjectEv
 __ZN7WebCore17HistoryController26saveDocumentAndScrollStateEv
@@ -490,6 +491,8 @@ __ZN7WebCore26contextMenuItemTagFontMenuEv
 __ZN7WebCore26contextMenuItemTagOpenLinkEv
 __ZN7WebCore26usesTestModeFocusRingColorEv
 __ZN7WebCore27CSSComputedStyleDeclarationC1EN3WTF10PassRefPtrINS_4NodeEEEbRKNS_6StringE
+__ZN7WebCore27DeviceOrientationClientMock14setOrientationEN3WTF10PassRefPtrINS_17DeviceOrientationEEE
+__ZN7WebCore27DeviceOrientationClientMockC1Ev
 __ZN7WebCore27applicationIsAdobeInstallerEv
 __ZN7WebCore27contextMenuItemTagShowFontsEv
 __ZN7WebCore27contextMenuItemTagUnderlineEv
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 7af6387..2008eaa 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -1190,10 +1190,12 @@
 		54C50F7B0E801DF3009832A0 /* XMLDocumentParserLibxml2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 54C50F7A0E801DF3009832A0 /* XMLDocumentParserLibxml2.cpp */; };
 		550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 550A0BC7085F6039007353D6 /* QualifiedName.cpp */; };
 		550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		590E1B4911E4EF4B0069F784 /* DeviceOrientation.h in Headers */ = {isa = PBXBuildFile; fileRef = 590E1B4811E4EF4B0069F784 /* DeviceOrientation.h */; };
+		590E1B4911E4EF4B0069F784 /* DeviceOrientation.h in Headers */ = {isa = PBXBuildFile; fileRef = 590E1B4811E4EF4B0069F784 /* DeviceOrientation.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		590E1B4B11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 590E1B4A11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp */; };
 		5913953B110758450083EC55 /* JNIBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 5913953A110758450083EC55 /* JNIBridge.h */; };
 		5913953D1107584E0083EC55 /* JNIBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5913953C1107584E0083EC55 /* JNIBridge.cpp */; };
+		59309A1111F4AE5800250603 /* DeviceOrientationClientMock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59309A1011F4AE5800250603 /* DeviceOrientationClientMock.cpp */; };
+		59309A1311F4AE6A00250603 /* DeviceOrientationClientMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 59309A1211F4AE6A00250603 /* DeviceOrientationClientMock.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		596229781133EFD700DC4CBB /* GeolocationPositionCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 596229771133EFD700DC4CBB /* GeolocationPositionCache.cpp */; };
 		5962297A1133EFE200DC4CBB /* GeolocationPositionCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 596229791133EFE200DC4CBB /* GeolocationPositionCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		599E759011055A1F00D904FA /* Bridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 599E758F11055A1F00D904FA /* Bridge.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -1203,7 +1205,7 @@
 		59A86008119DAFA100DEF1EF /* JSDeviceOrientationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A86007119DAFA100DEF1EF /* JSDeviceOrientationEvent.h */; };
 		59A8F1D411A69508001AC34A /* DeviceOrientationController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59A8F1D311A69508001AC34A /* DeviceOrientationController.cpp */; };
 		59A8F1D611A69513001AC34A /* DeviceOrientationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A8F1D511A69513001AC34A /* DeviceOrientationController.h */; };
-		59A8F1D811A69520001AC34A /* DeviceOrientationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A8F1D711A69520001AC34A /* DeviceOrientationClient.h */; };
+		59A8F1D811A69520001AC34A /* DeviceOrientationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A8F1D711A69520001AC34A /* DeviceOrientationClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		59A9E7B01104758800DFB4C1 /* JavaInstanceJSC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59A9E7AF1104758800DFB4C1 /* JavaInstanceJSC.cpp */; };
 		59A9E7B21104759400DFB4C1 /* JavaInstanceJSC.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A9E7B11104759400DFB4C1 /* JavaInstanceJSC.h */; };
 		59B597731108656B007159E8 /* BridgeJSC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59B597721108656B007159E8 /* BridgeJSC.cpp */; };
@@ -6964,6 +6966,8 @@
 		590E1B4A11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDeviceOrientationEventCustom.cpp; sourceTree = "<group>"; };
 		5913953A110758450083EC55 /* JNIBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JNIBridge.h; sourceTree = "<group>"; };
 		5913953C1107584E0083EC55 /* JNIBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JNIBridge.cpp; sourceTree = "<group>"; };
+		59309A1011F4AE5800250603 /* DeviceOrientationClientMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DeviceOrientationClientMock.cpp; path = mock/DeviceOrientationClientMock.cpp; sourceTree = "<group>"; };
+		59309A1211F4AE6A00250603 /* DeviceOrientationClientMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DeviceOrientationClientMock.h; path = mock/DeviceOrientationClientMock.h; sourceTree = "<group>"; };
 		596229771133EFD700DC4CBB /* GeolocationPositionCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationPositionCache.cpp; sourceTree = "<group>"; };
 		596229791133EFE200DC4CBB /* GeolocationPositionCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationPositionCache.h; sourceTree = "<group>"; };
 		599E758F11055A1F00D904FA /* Bridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Bridge.h; path = bridge/Bridge.h; sourceTree = "<group>"; };
@@ -12044,6 +12048,8 @@
 		59C77F101054591C00506104 /* mock */ = {
 			isa = PBXGroup;
 			children = (
+				59309A1211F4AE6A00250603 /* DeviceOrientationClientMock.h */,
+				59309A1011F4AE5800250603 /* DeviceOrientationClientMock.cpp */,
 			);
 			name = mock;
 			sourceTree = "<group>";
@@ -19868,6 +19874,7 @@
 				E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */,
 				97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */,
 				CE172E011136E8CE0062A533 /* ZoomMode.h in Headers */,
+				59309A1311F4AE6A00250603 /* DeviceOrientationClientMock.h in Headers */,
 				084D0E3D11F5816100081E1A /* SVGResources.h in Headers */,
 				084D0E3F11F5816100081E1A /* SVGResourcesCache.h in Headers */,
 				085B05C311FAE16C004D65F6 /* SVGResourcesCycleSolver.h in Headers */,
@@ -22266,6 +22273,7 @@
 				93F19B0508245E59001E9ABC /* XSLTProcessorLibxslt.cpp in Sources */,
 				E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
 				97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */,
+				59309A1111F4AE5800250603 /* DeviceOrientationClientMock.cpp in Sources */,
 				084D0E3C11F5816100081E1A /* SVGResources.cpp in Sources */,
 				084D0E3E11F5816100081E1A /* SVGResourcesCache.cpp in Sources */,
 				086A400611F6D6B7002CEC53 /* RenderSVGResourceContainer.cpp in Sources */,
diff --git a/WebCore/dom/DeviceOrientationClient.h b/WebCore/dom/DeviceOrientationClient.h
index 427412f..c969c95 100644
--- a/WebCore/dom/DeviceOrientationClient.h
+++ b/WebCore/dom/DeviceOrientationClient.h
@@ -29,15 +29,16 @@
 namespace WebCore {
 
 class DeviceOrientation;
+class DeviceOrientationController;
 
 class DeviceOrientationClient {
 public:
+    virtual ~DeviceOrientationClient() {}
+
+    virtual void setController(DeviceOrientationController*) = 0;
     virtual void startUpdating() = 0;
     virtual void stopUpdating() = 0;
     virtual DeviceOrientation* lastOrientation() const = 0;
-
-protected:
-    virtual ~DeviceOrientationClient() {}
 };
 
 } // namespace WebCore
diff --git a/WebCore/dom/DeviceOrientationController.cpp b/WebCore/dom/DeviceOrientationController.cpp
index a6a33f5..111577f 100644
--- a/WebCore/dom/DeviceOrientationController.cpp
+++ b/WebCore/dom/DeviceOrientationController.cpp
@@ -26,8 +26,6 @@
 #include "config.h"
 #include "DeviceOrientationController.h"
 
-#if ENABLE(DEVICE_ORIENTATION)
-
 #include "DeviceOrientation.h"
 #include "DeviceOrientationClient.h"
 #include "DeviceOrientationEvent.h"
@@ -39,6 +37,8 @@ DeviceOrientationController::DeviceOrientationController(Page* page, DeviceOrien
     , m_client(client)
     , m_timer(this, &DeviceOrientationController::timerFired)
 {
+    ASSERT(m_client);
+    m_client->setController(this);
 }
 
 void DeviceOrientationController::timerFired(Timer<DeviceOrientationController>* timer)
@@ -105,5 +105,3 @@ void DeviceOrientationController::didChangeDeviceOrientation(DeviceOrientation*
 }
 
 } // namespace WebCore
-
-#endif // ENABLE(DEVICE_ORIENTATION)
diff --git a/WebCore/dom/DeviceOrientationEvent.cpp b/WebCore/dom/DeviceOrientationEvent.cpp
index 992b6ce..932cb75 100644
--- a/WebCore/dom/DeviceOrientationEvent.cpp
+++ b/WebCore/dom/DeviceOrientationEvent.cpp
@@ -28,8 +28,6 @@
 
 #include "DeviceOrientation.h"
 
-#if ENABLE(DEVICE_ORIENTATION)
-
 namespace WebCore {
 
 DeviceOrientationEvent::~DeviceOrientationEvent()
@@ -57,5 +55,3 @@ void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& type
 }
 
 } // namespace WebCore
-
-#endif // ENABLE(DEVICE_ORIENTATION)
diff --git a/WebCore/platform/mock/DeviceOrientationClientMock.cpp b/WebCore/platform/mock/DeviceOrientationClientMock.cpp
new file mode 100644
index 0000000..c2c9316
--- /dev/null
+++ b/WebCore/platform/mock/DeviceOrientationClientMock.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DeviceOrientationClientMock.h"
+
+#include "DeviceOrientationController.h"
+
+namespace WebCore {
+
+DeviceOrientationClientMock::DeviceOrientationClientMock()
+    : m_controller(0)
+    , m_timer(this, &DeviceOrientationClientMock::timerFired)
+    , m_isUpdating(false)
+{
+}
+
+void DeviceOrientationClientMock::setController(DeviceOrientationController* controller)
+{
+    m_controller = controller;
+    ASSERT(m_controller);
+}
+
+void DeviceOrientationClientMock::startUpdating()
+{
+    m_isUpdating = true;
+}
+
+void DeviceOrientationClientMock::stopUpdating()
+{
+    m_isUpdating = false;
+    m_timer.stop();
+}
+
+void DeviceOrientationClientMock::setOrientation(PassRefPtr<DeviceOrientation> orientation)
+{
+    m_orientation = orientation;
+    if (m_isUpdating && !m_timer.isActive())
+        m_timer.startOneShot(0);
+}
+
+void DeviceOrientationClientMock::timerFired(Timer<DeviceOrientationClientMock>* timer)
+{
+    ASSERT_UNUSED(timer, timer == &m_timer);
+    m_timer.stop();
+    m_controller->didChangeDeviceOrientation(m_orientation.get());
+}
+
+} // namespace WebCore
diff --git a/WebCore/platform/mock/DeviceOrientationClientMock.h b/WebCore/platform/mock/DeviceOrientationClientMock.h
new file mode 100644
index 0000000..6691130
--- /dev/null
+++ b/WebCore/platform/mock/DeviceOrientationClientMock.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DeviceOrientationClientMock_h
+#define DeviceOrientationClientMock_h
+
+#include "DeviceOrientation.h"
+#include "DeviceOrientationClient.h"
+#include "Timer.h"
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class DeviceOrientationController;
+
+// A mock implementation of DeviceOrientationClient used to test the feature in
+// DumpRenderTree. Embedders should should configure the Page object to use this
+// client when running DumpRenderTree.
+class DeviceOrientationClientMock : public DeviceOrientationClient {
+public:
+    DeviceOrientationClientMock();
+
+    // DeviceOrientationClient
+    virtual void setController(DeviceOrientationController*);
+    virtual void startUpdating();
+    virtual void stopUpdating();
+    virtual DeviceOrientation* lastOrientation() const { return m_orientation.get(); }
+
+    void setOrientation(PassRefPtr<DeviceOrientation>);
+
+private:
+    void timerFired(Timer<DeviceOrientationClientMock>*);
+
+    RefPtr<DeviceOrientation> m_orientation;
+    DeviceOrientationController* m_controller;
+    Timer<DeviceOrientationClientMock> m_timer;
+    bool m_isUpdating;
+};
+
+} // namespace WebCore
+
+#endif // DeviceOrientationClientMock_h
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 7aa3128..3ab21d1 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,29 @@
+2010-07-29  Steve Block  <steveblock at google.com>
+
+        Reviewed by Jeremy Orlow.
+
+        Add LayoutTestController methods to test DeviceOrientation
+        https://bugs.webkit.org/show_bug.cgi?id=39589
+
+        * DumpRenderTree/LayoutTestController.cpp:
+        (setMockDeviceOrientationCallback):
+        (LayoutTestController::staticFunctions):
+        * DumpRenderTree/LayoutTestController.h:
+        * DumpRenderTree/chromium/LayoutTestController.cpp:
+        * DumpRenderTree/chromium/LayoutTestController.h:
+        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
+        (LayoutTestController::setMockDeviceOrientation):
+        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+        (LayoutTestController::setMockDeviceOrientation):
+        * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
+        (LayoutTestController::setMockDeviceOrientation):
+        * DumpRenderTree/qt/LayoutTestControllerQt.h:
+        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
+        (LayoutTestController::setMockDeviceOrientation):
+        * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
+        (LayoutTestController::setMockDeviceOrientation):
+        * Scripts/build-webkit:
+
 2010-07-28  Kenichi Ishibashi  <bashi at google.com>
 
         Reviewed by Shinichiro Hamaji.
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
index 6a957c1..d98164b 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.cpp
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
@@ -970,6 +970,27 @@ static JSValueRef setDomainRelaxationForbiddenForURLSchemeCallback(JSContextRef
     return JSValueMakeUndefined(context);
 }
 
+static JSValueRef setMockDeviceOrientationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    if (argumentCount < 6)
+        return JSValueMakeUndefined(context);
+
+    bool canProvideAlpha = JSValueToBoolean(context, arguments[0]);
+    double alpha = JSValueToNumber(context, arguments[1], exception);
+    ASSERT(!*exception);
+    bool canProvideBeta = JSValueToBoolean(context, arguments[2]);
+    double beta = JSValueToNumber(context, arguments[3], exception);
+    ASSERT(!*exception);
+    bool canProvideGamma = JSValueToBoolean(context, arguments[4]);
+    double gamma = JSValueToNumber(context, arguments[5], exception);
+    ASSERT(!*exception);
+
+    LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+    controller->setMockDeviceOrientation(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma);
+
+    return JSValueMakeUndefined(context);
+}
+
 static JSValueRef setMockGeolocationPositionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     if (argumentCount < 3)
@@ -1824,6 +1845,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
         { "setIconDatabaseEnabled", setIconDatabaseEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "setJavaScriptProfilingEnabled", setJavaScriptProfilingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "setMainFrameIsFirstResponder", setMainFrameIsFirstResponderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "setMockDeviceOrientation", setMockDeviceOrientationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "setMockGeolocationError", setMockGeolocationErrorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "setMockGeolocationPosition", setMockGeolocationPositionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "setNewWindowsCopyBackForwardList", setNewWindowsCopyBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.h b/WebKitTools/DumpRenderTree/LayoutTestController.h
index 30eb9bd..39cc3fb 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.h
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.h
@@ -88,6 +88,7 @@ public:
     void setJavaScriptProfilingEnabled(bool profilingEnabled);
     void setJavaScriptCanAccessClipboard(bool flag);
     void setMainFrameIsFirstResponder(bool flag);
+    void setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma);
     void setMockGeolocationError(int code, JSStringRef message);
     void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
     void setPersistentUserStyleSheetLocation(JSStringRef path);
diff --git a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
index ea1fd01..806bb8e 100644
--- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
@@ -164,6 +164,8 @@ LayoutTestController::LayoutTestController(TestShell* shell)
     bindMethod("forceRedSelectionColors", &LayoutTestController::forceRedSelectionColors);
     bindMethod("setEditingBehavior", &LayoutTestController::setEditingBehavior);
 
+    bindMethod("setMockDeviceOrientation", &LayoutTestController::setMockDeviceOrientation);
+
     bindMethod("setGeolocationPermission", &LayoutTestController::setGeolocationPermission);
     bindMethod("setMockGeolocationPosition", &LayoutTestController::setMockGeolocationPosition);
     bindMethod("setMockGeolocationError", &LayoutTestController::setMockGeolocationError);
@@ -1310,6 +1312,12 @@ void LayoutTestController::setEditingBehavior(const CppArgumentList& arguments,
         logErrorToConsole("Passed invalid editing behavior. Should be 'mac' or 'win'.");
 }
 
+void LayoutTestController::setMockDeviceOrientation(const CppArgumentList& arguments, CppVariant* result)
+{
+    // FIXME: Implement for DeviceOrientation layout tests.
+    // See https://bugs.webkit.org/show_bug.cgi?id=30335.
+}
+
 void LayoutTestController::setGeolocationPermission(const CppArgumentList& arguments, CppVariant* result)
 {
     result->setNull();
diff --git a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
index 46a14de..6748352 100644
--- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
+++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
@@ -282,6 +282,9 @@ public:
     void addUserScript(const CppArgumentList&, CppVariant*);
     void addUserStyleSheet(const CppArgumentList&, CppVariant*);
 
+    // DeviceOrientation related functions
+    void setMockDeviceOrientation(const CppArgumentList&, CppVariant*);
+
     // Geolocation related functions.
     void setGeolocationPermission(const CppArgumentList&, CppVariant*);
     void setMockGeolocationPosition(const CppArgumentList&, CppVariant*);
diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
index 5c942d3..2aece10 100644
--- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
@@ -442,6 +442,12 @@ void LayoutTestController::disableImageLoading()
     // Also need to make sure image loading is re-enabled for each new test.
 }
 
+void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
+{
+    // FIXME: Implement for DeviceOrientation layout tests.
+    // See https://bugs.webkit.org/show_bug.cgi?id=30335.
+}
+
 void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
 {
     // FIXME: Implement for Geolocation layout tests.
diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
index 6b921f0..7db7fff 100644
--- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
@@ -320,6 +320,13 @@ void LayoutTestController::setDomainRelaxationForbiddenForURLScheme(bool forbidd
     [WebView _setDomainRelaxationForbidden:forbidden forURLScheme:(NSString *)schemeCFString.get()];
 }
 
+void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
+{
+    // FIXME: Implement for DeviceOrientation layout tests.
+    // See https://bugs.webkit.org/show_bug.cgi?id=30335.
+
+}
+
 void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
 {
     WebGeolocationPosition *position = [[WebGeolocationPosition alloc] initWithTimestamp:0 latitude:latitude longitude:longitude accuracy:accuracy];
diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
index 8ebdbae..ca51f1b 100644
--- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
+++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
@@ -683,6 +683,12 @@ void LayoutTestController::setEditingBehavior(const QString& editingBehavior)
     DumpRenderTreeSupportQt::setEditingBehavior(m_drt->webPage(), editingBehavior);
 }
 
+void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
+{
+    // FIXME: Implement for DeviceOrientation layout tests.
+    // See https://bugs.webkit.org/show_bug.cgi?id=30335.
+}
+
 void LayoutTestController::setGeolocationPermission(bool allow)
 {
      m_isGeolocationPermissionSet = true;
diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
index 4ebf99d..1dee6ce 100644
--- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
+++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
@@ -197,6 +197,8 @@ public slots:
     // which is a Mac-specific test.
     void addDisallowedURL(const QString&) {}
 
+    void setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma);
+
     void setMockGeolocationError(int code, const QString& message);
     void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
     void setGeolocationPermission(bool allow);
diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
index a29623e..6519a97 100644
--- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
+++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
@@ -375,6 +375,12 @@ void LayoutTestController::setCustomPolicyDelegate(bool setDelegate, bool permis
         webView->setPolicyDelegate(0);
 }
 
+void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
+{
+    // FIXME: Implement for DeviceOrientation layout tests.
+    // See https://bugs.webkit.org/show_bug.cgi?id=30335.
+}
+
 void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
 {
     // FIXME: Implement for Geolocation layout tests.
diff --git a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
index 905463a..fd6b2d2 100644
--- a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
+++ b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
@@ -271,6 +271,12 @@ bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(JSStringRef prop
     return false;
 }
 
+void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
+{
+    // FIXME: Implement for DeviceOrientation layout tests.
+    // See https://bugs.webkit.org/show_bug.cgi?id=30335.
+}
+
 void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
 {
     // FIXME: Implement for Geolocation layout tests.
diff --git a/WebKitTools/Scripts/build-webkit b/WebKitTools/Scripts/build-webkit
index 21214cc..4639949 100755
--- a/WebKitTools/Scripts/build-webkit
+++ b/WebKitTools/Scripts/build-webkit
@@ -61,7 +61,7 @@ my ($linkPrefetchSupport, $threeDCanvasSupport, $threeDRenderingSupport, $channe
     $svgSupport, $svgAnimationSupport, $svgAsImageSupport, $svgDOMObjCBindingsSupport, $svgFontsSupport,
     $svgForeignObjectSupport, $svgUseSupport, $videoSupport, $webSocketsSupport, $webTimingSupport, $wmlSupport, $wcssSupport, $xhtmlmpSupport, $workersSupport,
     $xpathSupport, $xsltSupport, $coverageSupport, $notificationsSupport, $blobSliceSupport, $tiledBackingStoreSupport,
-    $fileReaderSupport, $fileWriterSupport, $fileSystemSupport, $directoryUploadSupport);
+    $fileReaderSupport, $fileWriterSupport, $fileSystemSupport, $directoryUploadSupport, $deviceOrientationSupport);
 
 my @features = (
     { option => "link-prefetch", desc => "Toggle pre fetching support",
@@ -204,6 +204,9 @@ my @features = (
 
     { option => "file-system", desc => "Toggle FileSystem support",
       define => "ENABLE_FILE_SYSTEM", default => 0, value => \$fileSystemSupport },
+
+    { option => "device-orientation", desc => "Toggle DeviceOrientation support",
+      define => "ENABLE_DEVICE_ORIENTATION", default => 0, value => \$deviceOrientationSupport },
 );
 
 # Update defaults from Qt's project file

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list