Changeset 139875 in webkit


Ignore:
Timestamp:
Jan 16, 2013 5:50:31 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[chromium] move setMockDeviceOrientation to TestRunner library
https://bugs.webkit.org/show_bug.cgi?id=106895

Patch by Dan Carney <dcarney@google.com> on 2013-01-16
Reviewed by Jochen Eisinger.

  • DumpRenderTree/chromium/DRTTestRunner.cpp:

(DRTTestRunner::DRTTestRunner):

  • DumpRenderTree/chromium/DRTTestRunner.h:

(DRTTestRunner):

  • DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h:

(WebKit):
(WebTestRunner::WebTestDelegate::setDeviceOrientation):

  • DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:

(WebTestRunner::TestRunner::TestRunner):
(WebTestRunner::TestRunner::setMockDeviceOrientation):
(WebTestRunner):

  • DumpRenderTree/chromium/TestRunner/src/TestRunner.h:

(TestRunner):

  • DumpRenderTree/chromium/WebViewHost.cpp:

(WebViewHost::setDeviceOrientation):

  • DumpRenderTree/chromium/WebViewHost.h:

(WebViewHost):

Location:
trunk/Tools
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r139872 r139875  
     12013-01-16  Dan Carney  <dcarney@google.com>
     2
     3        [chromium] move setMockDeviceOrientation to TestRunner library
     4        https://bugs.webkit.org/show_bug.cgi?id=106895
     5
     6        Reviewed by Jochen Eisinger.
     7
     8        * DumpRenderTree/chromium/DRTTestRunner.cpp:
     9        (DRTTestRunner::DRTTestRunner):
     10        * DumpRenderTree/chromium/DRTTestRunner.h:
     11        (DRTTestRunner):
     12        * DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h:
     13        (WebKit):
     14        (WebTestRunner::WebTestDelegate::setDeviceOrientation):
     15        * DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
     16        (WebTestRunner::TestRunner::TestRunner):
     17        (WebTestRunner::TestRunner::setMockDeviceOrientation):
     18        (WebTestRunner):
     19        * DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
     20        (TestRunner):
     21        * DumpRenderTree/chromium/WebViewHost.cpp:
     22        (WebViewHost::setDeviceOrientation):
     23        * DumpRenderTree/chromium/WebViewHost.h:
     24        (WebViewHost):
     25
    1262013-01-16  Jochen Eisinger  <jochen@chromium.org>
    227
  • trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp

    r139872 r139875  
    4242#include "WebBindings.h"
    4343#include "WebConsoleMessage.h"
    44 #include "WebDeviceOrientation.h"
    45 #include "WebDeviceOrientationClientMock.h"
    4644#include "WebDocument.h"
    4745#include "WebElement.h"
     
    126124    bindMethod("setCustomPolicyDelegate", &DRTTestRunner::setCustomPolicyDelegate);
    127125    bindMethod("setGeolocationPermission", &DRTTestRunner::setGeolocationPermission);
    128     bindMethod("setMockDeviceOrientation", &DRTTestRunner::setMockDeviceOrientation);
    129126    bindMethod("setMockGeolocationPositionUnavailableError", &DRTTestRunner::setMockGeolocationPositionUnavailableError);
    130127    bindMethod("setMockGeolocationPosition", &DRTTestRunner::setMockGeolocationPosition);
     
    526523}
    527524
    528 void DRTTestRunner::setMockDeviceOrientation(const CppArgumentList& arguments, CppVariant* result)
    529 {
    530     result->setNull();
    531     if (arguments.size() < 6 || !arguments[0].isBool() || !arguments[1].isNumber() || !arguments[2].isBool() || !arguments[3].isNumber() || !arguments[4].isBool() || !arguments[5].isNumber())
    532         return;
    533 
    534     WebDeviceOrientation orientation;
    535     orientation.setNull(false);
    536     if (arguments[0].toBoolean())
    537         orientation.setAlpha(arguments[1].toDouble());
    538     if (arguments[2].toBoolean())
    539         orientation.setBeta(arguments[3].toDouble());
    540     if (arguments[4].toBoolean())
    541         orientation.setGamma(arguments[5].toDouble());
    542 
    543     // Note that we only call setOrientation on the main page's mock since this is all that the
    544     // tests require. If necessary, we could get a list of WebViewHosts from the TestShell and
    545     // call setOrientation on each DeviceOrientationClientMock.
    546     m_shell->webViewHost()->deviceOrientationClientMock()->setOrientation(orientation);
    547 }
    548 
    549525// FIXME: For greater test flexibility, we should be able to set each page's geolocation mock individually.
    550526// https://bugs.webkit.org/show_bug.cgi?id=52368
  • trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.h

    r139872 r139875  
    125125    void numberOfPendingGeolocationPermissionRequests(const CppArgumentList&, CppVariant*);
    126126
    127     // DeviceOrientation related functions
    128     void setMockDeviceOrientation(const CppArgumentList&, CppVariant*);
    129 
    130127    // Geolocation related functions.
    131128    void setGeolocationPermission(const CppArgumentList&, CppVariant*);
  • trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h

    r139872 r139875  
    3838
    3939namespace WebKit {
     40class WebDeviceOrientation;
    4041class WebGamepads;
    4142class WebIntentRequest;
     
    9394    virtual std::string pathToLocalResource(const std::string& resource) { return std::string(); }
    9495    virtual void setLocale(const std::string&) { }
     96    virtual void setDeviceOrientation(WebKit::WebDeviceOrientation&) { }
    9597};
    9698
  • trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp

    r139872 r139875  
    3535#include "WebAnimationController.h"
    3636#include "WebBindings.h"
     37#include "WebDeviceOrientation.h"
    3738#include "WebDocument.h"
    3839#include "WebElement.h"
     
    145146    bindMethod("setSmartInsertDeleteEnabled", &TestRunner::setSmartInsertDeleteEnabled);
    146147    bindMethod("setSelectTrailingWhitespaceEnabled", &TestRunner::setSelectTrailingWhitespaceEnabled);
     148    bindMethod("setMockDeviceOrientation", &TestRunner::setMockDeviceOrientation);
    147149
    148150    // The following modify WebPreferences.
     
    11051107    m_webView->resize(newSize);
    11061108    result->set(true);
     1109}
     1110
     1111void TestRunner::setMockDeviceOrientation(const CppArgumentList& arguments, CppVariant* result)
     1112{
     1113    result->setNull();
     1114    if (arguments.size() < 6 || !arguments[0].isBool() || !arguments[1].isNumber() || !arguments[2].isBool() || !arguments[3].isNumber() || !arguments[4].isBool() || !arguments[5].isNumber())
     1115        return;
     1116
     1117    WebDeviceOrientation orientation;
     1118    orientation.setNull(false);
     1119    if (arguments[0].toBoolean())
     1120        orientation.setAlpha(arguments[1].toDouble());
     1121    if (arguments[2].toBoolean())
     1122        orientation.setBeta(arguments[3].toDouble());
     1123    if (arguments[4].toBoolean())
     1124        orientation.setGamma(arguments[5].toDouble());
     1125
     1126    // Note that we only call setOrientation on the main page's mock since this is all that the
     1127    // tests require. If necessary, we could get a list of WebViewHosts from the TestShell and
     1128    // call setOrientation on each DeviceOrientationClientMock.
     1129    m_delegate->setDeviceOrientation(orientation);
    11071130}
    11081131
  • trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h

    r139872 r139875  
    191191    void disableAutoResizeMode(const CppArgumentList&, CppVariant*);
    192192
     193    // DeviceOrientation related functions
     194    void setMockDeviceOrientation(const CppArgumentList&, CppVariant*);
     195
    193196    ///////////////////////////////////////////////////////////////////////////
    194197    // Methods modifying WebPreferences.
  • trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp

    r139872 r139875  
    11361136}
    11371137
     1138void WebViewHost::setDeviceOrientation(WebKit::WebDeviceOrientation& orientation)
     1139{
     1140    deviceOrientationClientMock()->setOrientation(orientation);
     1141}
     1142
    11381143// Public functions -----------------------------------------------------------
    11391144
  • trunk/Tools/DumpRenderTree/chromium/WebViewHost.h

    r139872 r139875  
    161161    virtual std::string pathToLocalResource(const std::string& url) OVERRIDE;
    162162    virtual void setLocale(const std::string&) OVERRIDE;
     163    virtual void setDeviceOrientation(WebKit::WebDeviceOrientation&) OVERRIDE;
    163164
    164165    // NavigationHost
Note: See TracChangeset for help on using the changeset viewer.