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

Unified Diff: chrome/browser/notifications/notification_test_util.h

Issue 4635007: When an extension is uninstalled, close all desktop notifications from that e... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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: chrome/browser/notifications/notification_test_util.h
===================================================================
--- chrome/browser/notifications/notification_test_util.h (revision 66634)
+++ chrome/browser/notifications/notification_test_util.h (working copy)
@@ -6,6 +6,8 @@
#define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_TEST_UTIL_H_
#pragma once
+#include <string>
+
#include "chrome/browser/notifications/notification_object_proxy.h"
#include "chrome/browser/notifications/balloon.h"
#include "gfx/size.h"
@@ -14,7 +16,7 @@
// the notification events are not important.
class MockNotificationDelegate : public NotificationDelegate {
public:
- explicit MockNotificationDelegate(std::string id) : id_(id) {}
+ explicit MockNotificationDelegate(const std::string& id) : id_(id) {}
virtual ~MockNotificationDelegate() {}
// NotificationDelegate interface.
@@ -26,6 +28,8 @@
private:
std::string id_;
+
+ DISALLOW_COPY_AND_ASSIGN(MockNotificationDelegate);
};
// Mock implementation of Javascript object proxy which logs events that
@@ -35,10 +39,11 @@
// |Logger| class provided in template must implement method
// static void log(string);
template<class Logger>
-class LoggingNotificationProxyBase : public NotificationObjectProxy {
+class LoggingNotificationDelegate : public NotificationDelegate {
public:
- LoggingNotificationProxyBase() :
- NotificationObjectProxy(0, 0, 0, false) {}
+ explicit LoggingNotificationDelegate(std::string id)
+ : notification_id_(id) {
+ }
// NotificationObjectProxy override
virtual void Display() {
@@ -47,12 +52,22 @@
virtual void Error() {
Logger::log("notification error\n");
}
+ virtual void Click() {
+ Logger::log("notification clicked\n");
+ }
virtual void Close(bool by_user) {
if (by_user)
Logger::log("notification closed by user\n");
else
Logger::log("notification closed by script\n");
}
+ virtual std::string id() const {
+ return notification_id_;
+ }
+ private:
+ std::string notification_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(LoggingNotificationDelegate);
};
// Test version of a balloon view which doesn't do anything

Powered by Google App Engine
This is Rietveld 408576698