Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: webkit/tools/test_shell/notification_presenter.h

Issue 1549039: Enable support for notifications layout tests in test shell.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/tools/test_shell/notification_presenter.h
===================================================================
--- webkit/tools/test_shell/notification_presenter.h (revision 0)
+++ webkit/tools/test_shell/notification_presenter.h (revision 0)
@@ -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_
« no previous file with comments | « webkit/tools/test_shell/layout_test_controller.cc ('k') | webkit/tools/test_shell/notification_presenter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698