diff options
author | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-14 19:33:34 +0000 |
---|---|---|
committer | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-14 19:33:34 +0000 |
commit | 33410c838b3d0ad411bb16b905e0188eacb40fb9 (patch) | |
tree | 52a98500792b161b07cf510159958eb5af7956cf /webkit/tools/test_shell/notification_presenter.h | |
parent | 79d3f1e0cd308344a0b59c28e4d305252267a409 (diff) | |
download | chromium_src-33410c838b3d0ad411bb16b905e0188eacb40fb9.zip chromium_src-33410c838b3d0ad411bb16b905e0188eacb40fb9.tar.gz chromium_src-33410c838b3d0ad411bb16b905e0188eacb40fb9.tar.bz2 |
Enable support for notifications layout tests in test shell.
BUG=none
TEST=notifications layout tests
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=44372
Reverted.
Review URL: http://codereview.chromium.org/1549039
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44515 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell/notification_presenter.h')
-rw-r--r-- | webkit/tools/test_shell/notification_presenter.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/webkit/tools/test_shell/notification_presenter.h b/webkit/tools/test_shell/notification_presenter.h new file mode 100644 index 0000000..07d7978 --- /dev/null +++ b/webkit/tools/test_shell/notification_presenter.h @@ -0,0 +1,45 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WEBKIT_TOOLS_TEST_SHELL_NOTIFICATION_PRESENTER_H_ +#define WEBKIT_TOOLS_TEST_SHELL_NOTIFICATION_PRESENTER_H_ + +#include <set> +#include <string> + +#include "third_party/WebKit/WebKit/chromium/public/WebNotificationPresenter.h" +#include "webkit/tools/test_shell/test_shell.h" + +// A class that implements NotificationPresenter for the test shell. +class TestNotificationPresenter : public WebKit::WebNotificationPresenter { + public: + explicit TestNotificationPresenter(TestShell* shell) + : shell_(shell) { + } + + // Called by the LayoutTestController to simulate a user granting + // permission. + void grantPermission(const std::string& origin); + + // WebKit::WebNotificationPresenter interface + virtual bool show(const WebKit::WebNotification&); + virtual void cancel(const WebKit::WebNotification&); + virtual void objectDestroyed(const WebKit::WebNotification&); + virtual Permission checkPermission(const WebKit::WebURL& url); + virtual void requestPermission(const WebKit::WebSecurityOrigin& origin, + WebKit::WebNotificationPermissionCallback* callback); + + void Reset() { + allowed_origins_.clear(); + } + + private: + // Non-owned pointer. The NotificationPresenter is owned by the test shell. + TestShell* shell_; + + // List of allowed origins. + std::set<std::string> allowed_origins_; +}; + +#endif // WEBKIT_TOOLS_TEST_SHELL_NOTIFICATION_PRESENTER_H_ |