⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 242960 in webkit


Ignore:
Timestamp:
Mar 14, 2019, 1:40:09 PM (7 years ago)
Author:
Chris Dumez
Message:

Add WebsitePolicy for the client to specify the device orientation & motion access policy
https://bugs.webkit.org/show_bug.cgi?id=195750

Reviewed by Geoffrey Garen.

Source/WebCore:

Add WebsitePolicy for the client to specify the device orientation & motion access policy. If
the client already knows access to the device motion & orientation API will be granted / denied,
it can let WebKit know via WebsitePolicies so that WebKit will not ask the client when the
permission is requested by JS.

  • dom/DeviceOrientationAndMotionAccessController.cpp:

(WebCore::DeviceOrientationAndMotionAccessController::shouldAllowAccess):
(WebCore::DeviceOrientationAndMotionAccessController::setAccessState):
(WebCore::DeviceOrientationAndMotionAccessController::accessState const):

  • dom/DeviceOrientationAndMotionAccessController.h:
  • loader/DocumentLoader.h:

(WebCore::DocumentLoader::deviceOrientationAndMotionAccessState const):
(WebCore::DocumentLoader::setDeviceOrientationAndMotionAccessState):

  • page/DOMWindow.cpp:

(WebCore::DOMWindow::isAllowedToUseDeviceMotionOrientation const):

Source/WebKit:

Add WebsitePolicy for the client to specify the device orientation & motion access policy. If
the client already knows access to the device motion & orientation API will be granted / denied,
it can let WebKit know via WebsitePolicies so that WebKit will not ask the client when the
permission is requested by JS.

  • Shared/WebsitePoliciesData.cpp:

(WebKit::WebsitePoliciesData::encode const):
(WebKit::WebsitePoliciesData::decode):
(WebKit::WebsitePoliciesData::applyToDocumentLoader):

  • Shared/WebsitePoliciesData.h:
  • UIProcess/API/APIWebsitePolicies.cpp:

(API::WebsitePolicies::data):

  • UIProcess/API/APIWebsitePolicies.h:
  • UIProcess/API/Cocoa/_WKWebsitePolicies.h:
  • UIProcess/API/Cocoa/_WKWebsitePolicies.mm:

(-[_WKWebsitePolicies setDeviceOrientationAndMotionAccessPolicy:]):
(-[_WKWebsitePolicies deviceOrientationAndMotionAccessPolicy]):

Tools:

Add API test coverage.

  • TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm:

(-[WebsitePoliciesDeviceOrientationDelegate initWithDeviceOrientationAccessPolicy:]):
(-[WebsitePoliciesDeviceOrientationDelegate _webView:decidePolicyForNavigationAction:userInfo:decisionHandler:]):
(-[WebsitePoliciesDeviceOrientationUIDelegate _webView:shouldAllowDeviceOrientationAndMotionAccessRequestedByFrame:decisionHandler:]):

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r242956 r242960  
     12019-03-14  Chris Dumez  <cdumez@apple.com>
     2
     3        Add WebsitePolicy for the client to specify the device orientation & motion access policy
     4        https://bugs.webkit.org/show_bug.cgi?id=195750
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Add WebsitePolicy for the client to specify the device orientation & motion access policy. If
     9        the client already knows access to the device motion & orientation API will be granted / denied,
     10        it can let WebKit know via WebsitePolicies so that WebKit will not ask the client when the
     11        permission is requested by JS.
     12
     13        * dom/DeviceOrientationAndMotionAccessController.cpp:
     14        (WebCore::DeviceOrientationAndMotionAccessController::shouldAllowAccess):
     15        (WebCore::DeviceOrientationAndMotionAccessController::setAccessState):
     16        (WebCore::DeviceOrientationAndMotionAccessController::accessState const):
     17        * dom/DeviceOrientationAndMotionAccessController.h:
     18        * loader/DocumentLoader.h:
     19        (WebCore::DocumentLoader::deviceOrientationAndMotionAccessState const):
     20        (WebCore::DocumentLoader::setDeviceOrientationAndMotionAccessState):
     21        * page/DOMWindow.cpp:
     22        (WebCore::DOMWindow::isAllowedToUseDeviceMotionOrientation const):
     23
    1242019-03-14  Shawn Roberts  <sroberts@apple.com>
    225
  • trunk/Source/WebCore/dom/DeviceOrientationAndMotionAccessController.cpp

    r242951 r242960  
    3333#include "DOMWindow.h"
    3434#include "Document.h"
     35#include "DocumentLoader.h"
    3536#include "Frame.h"
    3637#include "Page.h"
     
    4748void DeviceOrientationAndMotionAccessController::shouldAllowAccess(Function<void(ExceptionOr<bool> granted)>&& callback)
    4849{
    49     if (m_accessState)
    50         return callback(*m_accessState);
     50    if (auto accessState = this->accessState())
     51        return callback(*accessState);
     52    ASSERT(m_document.frame());
    5153
    5254    if (!UserGestureIndicator::processingUserGesture())
     
    5759        return callback(false);
    5860
    59     auto* frame = m_document.frame();
    60     if (!frame)
    61         return callback(false);
    62 
    6361    m_pendingRequests.append(WTFMove(callback));
    6462    if (m_pendingRequests.size() > 1)
    6563        return;
    6664
    67     page->chrome().client().shouldAllowDeviceOrientationAndMotionAccess(*frame, [this, weakThis = makeWeakPtr(*this)](bool granted) mutable {
     65    page->chrome().client().shouldAllowDeviceOrientationAndMotionAccess(*m_document.frame(), [this, weakThis = makeWeakPtr(*this)](bool granted) mutable {
    6866        if (weakThis)
    6967            setAccessState(granted);
     
    7371void DeviceOrientationAndMotionAccessController::setAccessState(bool granted)
    7472{
    75     ASSERT(!m_accessState);
    76 
    77     m_accessState = granted;
     73    auto* frame = m_document.frame();
     74    if (frame && frame->loader().documentLoader())
     75        frame->loader().documentLoader()->setDeviceOrientationAndMotionAccessState(granted);
    7876
    7977    auto pendingRequests = WTFMove(m_pendingRequests);
     
    9088}
    9189
     90Optional<bool> DeviceOrientationAndMotionAccessController::accessState() const
     91{
     92    auto* frame = m_document.frame();
     93    return frame && frame->loader().documentLoader() ? frame->loader().documentLoader()->deviceOrientationAndMotionAccessState() : false;
     94}
     95
    9296} // namespace WebCore
    9397
  • trunk/Source/WebCore/dom/DeviceOrientationAndMotionAccessController.h

    r242951 r242960  
    4242    explicit DeviceOrientationAndMotionAccessController(Document&);
    4343
    44     const Optional<bool>& accessState() const { return m_accessState; }
     44    Optional<bool> accessState() const;
    4545    void shouldAllowAccess(Function<void(ExceptionOr<bool> granted)>&&);
    4646
     
    4949
    5050    Document& m_document;
    51     Optional<bool> m_accessState;
    5251    Vector<Function<void(bool)>> m_pendingRequests;
    5352};
  • trunk/Source/WebCore/loader/DocumentLoader.h

    r241480 r242960  
    263263    void setUserContentExtensionsEnabled(bool enabled) { m_userContentExtensionsEnabled = enabled; }
    264264
    265     bool deviceOrientationEventEnabled() const { return m_deviceOrientationEventEnabled; }
    266     void setDeviceOrientationEventEnabled(bool enabled) { m_deviceOrientationEventEnabled = enabled; }
     265    const Optional<bool>& deviceOrientationAndMotionAccessState() const { return m_deviceOrientationAndMotionAccessState; }
     266    void setDeviceOrientationAndMotionAccessState(const Optional<bool>& state) { m_deviceOrientationAndMotionAccessState = state; }
    267267
    268268    AutoplayPolicy autoplayPolicy() const { return m_autoplayPolicy; }
     
    553553    String m_customNavigatorPlatform;
    554554    bool m_userContentExtensionsEnabled { true };
    555     bool m_deviceOrientationEventEnabled { true };
     555    Optional<bool> m_deviceOrientationAndMotionAccessState;
    556556    AutoplayPolicy m_autoplayPolicy { AutoplayPolicy::Default };
    557557    OptionSet<AutoplayQuirk> m_allowedAutoplayQuirks;
  • trunk/Source/WebCore/page/DOMWindow.cpp

    r242899 r242960  
    18411841bool DOMWindow::isAllowedToUseDeviceMotionOrientation(String& message) const
    18421842{
    1843     if (!frame() || !frame()->settings().deviceOrientationEventEnabled() || !document() || !document()->loader() || !document()->loader()->deviceOrientationEventEnabled()) {
     1843    if (!frame() || !frame()->settings().deviceOrientationEventEnabled()) {
    18441844        message = "API is disabled"_s;
    18451845        return false;
  • trunk/Source/WebKit/ChangeLog

    r242953 r242960  
     12019-03-14  Chris Dumez  <cdumez@apple.com>
     2
     3        Add WebsitePolicy for the client to specify the device orientation & motion access policy
     4        https://bugs.webkit.org/show_bug.cgi?id=195750
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Add WebsitePolicy for the client to specify the device orientation & motion access policy. If
     9        the client already knows access to the device motion & orientation API will be granted / denied,
     10        it can let WebKit know via WebsitePolicies so that WebKit will not ask the client when the
     11        permission is requested by JS.
     12
     13        * Shared/WebsitePoliciesData.cpp:
     14        (WebKit::WebsitePoliciesData::encode const):
     15        (WebKit::WebsitePoliciesData::decode):
     16        (WebKit::WebsitePoliciesData::applyToDocumentLoader):
     17        * Shared/WebsitePoliciesData.h:
     18        * UIProcess/API/APIWebsitePolicies.cpp:
     19        (API::WebsitePolicies::data):
     20        * UIProcess/API/APIWebsitePolicies.h:
     21        * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
     22        * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
     23        (-[_WKWebsitePolicies setDeviceOrientationAndMotionAccessPolicy:]):
     24        (-[_WKWebsitePolicies deviceOrientationAndMotionAccessPolicy]):
     25
    1262019-03-14  Timothy Hatcher  <timothy@apple.com>
    227
  • trunk/Source/WebKit/Shared/WebsitePoliciesData.cpp

    r240646 r242960  
    3838{
    3939    encoder << contentBlockersEnabled;
    40     encoder << deviceOrientationEventEnabled;
    4140    encoder << autoplayPolicy;
     41    encoder << deviceOrientationAndMotionAccessState;
    4242    encoder << allowedAutoplayQuirks;
    4343    encoder << customHeaderFields;
     
    5555    if (!contentBlockersEnabled)
    5656        return WTF::nullopt;
    57 
    58     Optional<bool> deviceOrientationEventEnabled;
    59     decoder >> deviceOrientationEventEnabled;
    60     if (!deviceOrientationEventEnabled)
    61         return WTF::nullopt;
    6257   
    6358    Optional<WebsiteAutoplayPolicy> autoplayPolicy;
    6459    decoder >> autoplayPolicy;
    6560    if (!autoplayPolicy)
     61        return WTF::nullopt;
     62
     63    Optional<Optional<bool>> deviceOrientationAndMotionAccessState;
     64    decoder >> deviceOrientationAndMotionAccessState;
     65    if (!deviceOrientationAndMotionAccessState)
    6666        return WTF::nullopt;
    6767   
     
    103103    return { {
    104104        WTFMove(*contentBlockersEnabled),
    105         WTFMove(*deviceOrientationEventEnabled),
    106105        WTFMove(*allowedAutoplayQuirks),
    107106        WTFMove(*autoplayPolicy),
     107        WTFMove(*deviceOrientationAndMotionAccessState),
    108108        WTFMove(*customHeaderFields),
    109109        WTFMove(*popUpPolicy),
     
    121121    documentLoader.setCustomJavaScriptUserAgentAsSiteSpecificQuirks(websitePolicies.customJavaScriptUserAgentAsSiteSpecificQuirks);
    122122    documentLoader.setCustomNavigatorPlatform(websitePolicies.customNavigatorPlatform);
    123     documentLoader.setDeviceOrientationEventEnabled(websitePolicies.deviceOrientationEventEnabled);
     123    documentLoader.setDeviceOrientationAndMotionAccessState(websitePolicies.deviceOrientationAndMotionAccessState);
    124124   
    125125    // Only setUserContentExtensionsEnabled if it hasn't already been disabled by reloading without content blockers.
  • trunk/Source/WebKit/Shared/WebsitePoliciesData.h

    r240646 r242960  
    4848
    4949    bool contentBlockersEnabled { true };
    50     bool deviceOrientationEventEnabled { true };
    5150    OptionSet<WebsiteAutoplayQuirk> allowedAutoplayQuirks;
    5251    WebsiteAutoplayPolicy autoplayPolicy { WebsiteAutoplayPolicy::Default };
     52    Optional<bool> deviceOrientationAndMotionAccessState;
    5353    Vector<WebCore::HTTPHeaderField> customHeaderFields;
    5454    WebsitePopUpPolicy popUpPolicy { WebsitePopUpPolicy::Default };
  • trunk/Source/WebKit/UIProcess/API/APIWebsitePolicies.cpp

    r240646 r242960  
    5757    if (m_websiteDataStore)
    5858        parameters = m_websiteDataStore->websiteDataStore().parameters();
    59     return { contentBlockersEnabled(), deviceOrientationEventEnabled(), allowedAutoplayQuirks(), autoplayPolicy(),
     59    return { contentBlockersEnabled(), allowedAutoplayQuirks(), autoplayPolicy(), deviceOrientationAndMotionAccessState(),
    6060        customHeaderFields(), popUpPolicy(), WTFMove(parameters), m_customUserAgent, m_customJavaScriptUserAgentAsSiteSpecificQuirks, m_customNavigatorPlatform };
    6161}
  • trunk/Source/WebKit/UIProcess/API/APIWebsitePolicies.h

    r242776 r242960  
    5050    bool contentBlockersEnabled() const { return m_contentBlockersEnabled; }
    5151    void setContentBlockersEnabled(bool enabled) { m_contentBlockersEnabled = enabled; }
    52 
    53     bool deviceOrientationEventEnabled() const { return m_deviceOrientationEventEnabled; }
    54     void setDeviceOrientationEventEnabled(bool enabled) { m_deviceOrientationEventEnabled = enabled; }
    5552   
    5653    OptionSet<WebKit::WebsiteAutoplayQuirk> allowedAutoplayQuirks() const { return m_allowedAutoplayQuirks; }
     
    5956    WebKit::WebsiteAutoplayPolicy autoplayPolicy() const { return m_autoplayPolicy; }
    6057    void setAutoplayPolicy(WebKit::WebsiteAutoplayPolicy policy) { m_autoplayPolicy = policy; }
     58
     59    const Optional<bool>& deviceOrientationAndMotionAccessState() const { return m_deviceOrientationAndMotionAccessState; }
     60    void setDeviceOrientationAndMotionAccessState(Optional<bool> state) { m_deviceOrientationAndMotionAccessState = state; }
    6161   
    6262    const Vector<WebCore::HTTPHeaderField>& customHeaderFields() const { return m_customHeaderFields; }
     
    8585
    8686    bool m_contentBlockersEnabled { true };
    87     bool m_deviceOrientationEventEnabled { true };
    8887    OptionSet<WebKit::WebsiteAutoplayQuirk> m_allowedAutoplayQuirks;
    8988    WebKit::WebsiteAutoplayPolicy m_autoplayPolicy { WebKit::WebsiteAutoplayPolicy::Default };
     89    Optional<bool> m_deviceOrientationAndMotionAccessState;
    9090    Vector<WebCore::HTTPHeaderField> m_customHeaderFields;
    9191    WebKit::WebsitePopUpPolicy m_popUpPolicy { WebKit::WebsitePopUpPolicy::Default };
  • trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.h

    r242339 r242960  
    4646} WK_API_AVAILABLE(macosx(10.14), ios(12.0));
    4747
     48typedef NS_OPTIONS(NSUInteger, _WKWebsiteDeviceOrientationAndMotionAccessPolicy) {
     49    _WKWebsiteDeviceOrientationAndMotionAccessPolicyAsk,
     50    _WKWebsiteDeviceOrientationAndMotionAccessPolicyGrant,
     51    _WKWebsiteDeviceOrientationAndMotionAccessPolicyDeny,
     52} WK_API_AVAILABLE(macosx(10.14), ios(12.0));
     53
    4854@class WKWebsiteDataStore;
    4955
     
    6066@property (nonatomic, copy) NSString *customJavaScriptUserAgentAsSiteSpecificQuirks WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
    6167@property (nonatomic, copy) NSString *customNavigatorPlatform WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
    62 @property (nonatomic) BOOL deviceOrientationEventEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
     68@property (nonatomic) _WKWebsiteDeviceOrientationAndMotionAccessPolicy deviceOrientationAndMotionAccessPolicy WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
    6369
    6470@end
  • trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm

    r242339 r242960  
    5858}
    5959
    60 - (void)setDeviceOrientationEventEnabled:(BOOL)deviceOrientationEventEnabled
    61 {
    62     _websitePolicies->setDeviceOrientationEventEnabled(deviceOrientationEventEnabled);
    63 }
    64 
    65 - (BOOL)deviceOrientationEventEnabled
    66 {
    67     return _websitePolicies->deviceOrientationEventEnabled();
    68 }
    69 
    7060- (void)setAllowedAutoplayQuirks:(_WKWebsiteAutoplayQuirk)allowedQuirks
    7161{
     
    139129}
    140130
     131- (void)setDeviceOrientationAndMotionAccessPolicy:(_WKWebsiteDeviceOrientationAndMotionAccessPolicy)policy
     132{
     133    switch (policy) {
     134    case _WKWebsiteDeviceOrientationAndMotionAccessPolicyAsk:
     135        _websitePolicies->setDeviceOrientationAndMotionAccessState(WTF::nullopt);
     136        break;
     137    case _WKWebsiteDeviceOrientationAndMotionAccessPolicyGrant:
     138        _websitePolicies->setDeviceOrientationAndMotionAccessState(true);
     139        break;
     140    case _WKWebsiteDeviceOrientationAndMotionAccessPolicyDeny:
     141        _websitePolicies->setDeviceOrientationAndMotionAccessState(false);
     142        break;
     143    }
     144}
     145
     146- (_WKWebsiteDeviceOrientationAndMotionAccessPolicy)deviceOrientationAndMotionAccessPolicy
     147{
     148    if (!_websitePolicies->deviceOrientationAndMotionAccessState())
     149        return _WKWebsiteDeviceOrientationAndMotionAccessPolicyAsk;
     150    return *_websitePolicies->deviceOrientationAndMotionAccessState() ? _WKWebsiteDeviceOrientationAndMotionAccessPolicyGrant : _WKWebsiteDeviceOrientationAndMotionAccessPolicyDeny;
     151}
     152
    141153- (void)setPopUpPolicy:(_WKWebsitePopUpPolicy)policy
    142154{
  • trunk/Tools/ChangeLog

    r242952 r242960  
     12019-03-14  Chris Dumez  <cdumez@apple.com>
     2
     3        Add WebsitePolicy for the client to specify the device orientation & motion access policy
     4        https://bugs.webkit.org/show_bug.cgi?id=195750
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Add API test coverage.
     9
     10        * TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm:
     11        (-[WebsitePoliciesDeviceOrientationDelegate initWithDeviceOrientationAccessPolicy:]):
     12        (-[WebsitePoliciesDeviceOrientationDelegate _webView:decidePolicyForNavigationAction:userInfo:decisionHandler:]):
     13        (-[WebsitePoliciesDeviceOrientationUIDelegate _webView:shouldAllowDeviceOrientationAndMotionAccessRequestedByFrame:decisionHandler:]):
     14
    1152019-03-14  Chris Dumez  <cdumez@apple.com>
    216
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm

    r242823 r242960  
    12471247
    12481248@interface WebsitePoliciesDeviceOrientationDelegate : NSObject <WKNavigationDelegate> {
    1249     BOOL _deviceOrientationEventEnabled;
    1250 }
    1251 - (instancetype)initWithDeviceOrientationEventEnabled:(BOOL)enabled;
     1249    _WKWebsiteDeviceOrientationAndMotionAccessPolicy _accessPolicy;
     1250}
     1251- (instancetype)initWithDeviceOrientationAccessPolicy:(_WKWebsiteDeviceOrientationAndMotionAccessPolicy)accessPolicy;
    12521252@end
    12531253
    12541254@implementation WebsitePoliciesDeviceOrientationDelegate
    12551255
    1256 - (instancetype)initWithDeviceOrientationEventEnabled:(BOOL)enabled
     1256- (instancetype)initWithDeviceOrientationAccessPolicy:(_WKWebsiteDeviceOrientationAndMotionAccessPolicy)accessPolicy
    12571257{
    12581258    self = [super init];
    1259     _deviceOrientationEventEnabled = enabled;
     1259    _accessPolicy = accessPolicy;
    12601260    return self;
    12611261}
     
    12641264{
    12651265    _WKWebsitePolicies *websitePolicies = [[[_WKWebsitePolicies alloc] init] autorelease];
    1266     [websitePolicies setDeviceOrientationEventEnabled:_deviceOrientationEventEnabled];
     1266    [websitePolicies setDeviceOrientationAndMotionAccessPolicy:_accessPolicy];
    12671267
    12681268    decisionHandler(WKNavigationActionPolicyAllow, websitePolicies);
     
    12761276@end
    12771277
     1278static bool calledShouldAllowDeviceOrientationAndMotionAccessDelegate = false;
     1279
    12781280@interface WebsitePoliciesDeviceOrientationUIDelegate : NSObject <WKUIDelegatePrivate> {
    12791281}
     
    12841286- (void)_webView:(WKWebView *)webView shouldAllowDeviceOrientationAndMotionAccessRequestedByFrame:(WKFrameInfo *)requestingFrame decisionHandler:(void (^)(BOOL))decisionHandler
    12851287{
     1288    calledShouldAllowDeviceOrientationAndMotionAccessDelegate = true;
    12861289    decisionHandler(YES);
    12871290}
     
    12891292@end
    12901293
    1291 static void runWebsitePoliciesDeviceOrientationEventTest(bool websitePolicyValue)
     1294static void runWebsitePoliciesDeviceOrientationEventTest(_WKWebsiteDeviceOrientationAndMotionAccessPolicy accessPolicy)
    12921295{
    12931296    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
     
    12991302    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
    13001303
    1301     auto delegate = adoptNS([[WebsitePoliciesDeviceOrientationDelegate alloc] initWithDeviceOrientationEventEnabled:websitePolicyValue]);
     1304    auto delegate = adoptNS([[WebsitePoliciesDeviceOrientationDelegate alloc] initWithDeviceOrientationAccessPolicy:accessPolicy]);
    13021305    [webView setNavigationDelegate:delegate.get()];
    13031306    auto uiDelegate = adoptNS([[WebsitePoliciesDeviceOrientationUIDelegate alloc] init]);
     
    13221325    [webView _simulateDeviceOrientationChangeWithAlpha:1.0 beta:2.0 gamma:3.0];
    13231326
    1324     if (websitePolicyValue)
     1327    if (accessPolicy == _WKWebsiteDeviceOrientationAndMotionAccessPolicyAsk)
     1328        EXPECT_TRUE(calledShouldAllowDeviceOrientationAndMotionAccessDelegate);
     1329    else
     1330        EXPECT_FALSE(calledShouldAllowDeviceOrientationAndMotionAccessDelegate);
     1331
     1332    if (accessPolicy != _WKWebsiteDeviceOrientationAndMotionAccessPolicyDeny)
    13251333        TestWebKitAPI::Util::run(&didReceiveMessage);
    13261334    else {
     
    13301338}
    13311339
    1332 TEST(WebKit, WebsitePoliciesDeviceOrientationEventEnabled)
    1333 {
    1334     runWebsitePoliciesDeviceOrientationEventTest(true);
    1335 }
    1336 
    1337 TEST(WebKit, WebsitePoliciesDeviceOrientationEventDisabled)
    1338 {
    1339     runWebsitePoliciesDeviceOrientationEventTest(false);
     1340TEST(WebKit, WebsitePoliciesDeviceOrientationGrantAccess)
     1341{
     1342    runWebsitePoliciesDeviceOrientationEventTest(_WKWebsiteDeviceOrientationAndMotionAccessPolicyGrant);
     1343}
     1344
     1345TEST(WebKit, WebsitePoliciesDeviceOrientationDenyAccess)
     1346{
     1347    runWebsitePoliciesDeviceOrientationEventTest(_WKWebsiteDeviceOrientationAndMotionAccessPolicyDeny);
     1348}
     1349
     1350TEST(WebKit, WebsitePoliciesDeviceOrientationAskAccess)
     1351{
     1352    runWebsitePoliciesDeviceOrientationEventTest(_WKWebsiteDeviceOrientationAndMotionAccessPolicyAsk);
    13401353}
    13411354
Note: See TracChangeset for help on using the changeset viewer.