summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-06 18:21:36 +0000
committerdcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-06 18:21:36 +0000
commit8007ad499fb26b50b51fab300c7aa2f3900bf8ea (patch)
treeb8d340cd324e45d4ae1fe35fceffc1c232091f4b
parentabe115b1ab21b4c22a3dd8e5cd026d08be0580d3 (diff)
downloadchromium_src-8007ad499fb26b50b51fab300c7aa2f3900bf8ea.zip
chromium_src-8007ad499fb26b50b51fab300c7aa2f3900bf8ea.tar.gz
chromium_src-8007ad499fb26b50b51fab300c7aa2f3900bf8ea.tar.bz2
Update test_shell NotificationPresenter in preparation for WebKit r99368
BUG=none TEST=test_shell compiles. TBR=johnnyg@chromium.org Review URL: http://codereview.chromium.org/8484005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108814 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/tools/test_shell/notification_presenter.cc13
-rw-r--r--webkit/tools/test_shell/notification_presenter.h1
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);