diff options
-rw-r--r-- | webkit/tools/test_shell/notification_presenter.cc | 13 | ||||
-rw-r--r-- | webkit/tools/test_shell/notification_presenter.h | 1 |
2 files changed, 11 insertions, 3 deletions
diff --git a/webkit/tools/test_shell/notification_presenter.cc b/webkit/tools/test_shell/notification_presenter.cc index b5f7234..cd0a177 100644 --- a/webkit/tools/test_shell/notification_presenter.cc +++ b/webkit/tools/test_shell/notification_presenter.cc @@ -40,9 +40,7 @@ void TestNotificationPresenter::Reset() { } void TestNotificationPresenter::grantPermission(const std::string& origin) { - // Make sure it's in the form of an origin. - GURL url(origin); - allowed_origins_.insert(url.GetOrigin().spec()); + allowed_origins_.insert(origin); } // The output from all these methods matches what DumpRenderTree produces. @@ -98,6 +96,15 @@ void TestNotificationPresenter::objectDestroyed( } WebNotificationPresenter::Permission TestNotificationPresenter::checkPermission( + const WebSecurityOrigin& origin) { + // Check with the layout test controller + bool allowed = allowed_origins_.find(origin.toString().utf8().data()) + != allowed_origins_.end(); + return allowed ? WebNotificationPresenter::PermissionAllowed + : WebNotificationPresenter::PermissionDenied; +} + +WebNotificationPresenter::Permission TestNotificationPresenter::checkPermission( const WebURL& url) { // Check with the layout test controller std::string origin = static_cast<GURL>(url).GetOrigin().spec(); diff --git a/webkit/tools/test_shell/notification_presenter.h b/webkit/tools/test_shell/notification_presenter.h index 7a69a1b..734f221 100644 --- a/webkit/tools/test_shell/notification_presenter.h +++ b/webkit/tools/test_shell/notification_presenter.h @@ -28,6 +28,7 @@ class TestNotificationPresenter : public WebKit::WebNotificationPresenter { virtual bool show(const WebKit::WebNotification&); virtual void cancel(const WebKit::WebNotification&); virtual void objectDestroyed(const WebKit::WebNotification&); + virtual Permission checkPermission(const WebKit::WebSecurityOrigin& origin); virtual Permission checkPermission(const WebKit::WebURL& url); virtual void requestPermission(const WebKit::WebSecurityOrigin& origin, WebKit::WebNotificationPermissionCallback* callback); |