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

Side by Side Diff: chrome/browser/notifications/notification_test_util.h

Issue 580243004: Remove unnecessary image downloading handler of notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fix of desktop linux/win Created 6 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_TEST_UTIL_H_ 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_TEST_UTIL_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_TEST_UTIL_H_ 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_TEST_UTIL_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
11 #include "chrome/browser/notifications/notification.h" 11 #include "chrome/browser/notifications/notification.h"
12 #include "chrome/browser/notifications/notification_object_proxy.h" 12 #include "chrome/browser/notifications/notification_object_proxy.h"
13 #include "chrome/browser/notifications/notification_ui_manager.h" 13 #include "chrome/browser/notifications/notification_ui_manager.h"
14 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" 14 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "ui/gfx/size.h" 16 #include "ui/gfx/size.h"
17 17
18 // NotificationDelegate which does nothing, useful for testing when 18 // NotificationDelegate which does nothing, useful for testing when
19 // the notification events are not important. 19 // the notification events are not important.
20 class MockNotificationDelegate : public NotificationDelegate { 20 class MockNotificationDelegate : public NotificationDelegate {
21 public: 21 public:
22 explicit MockNotificationDelegate(const std::string& id); 22 explicit MockNotificationDelegate(const std::string& id);
23 23
24 // NotificationDelegate interface. 24 // NotificationDelegate interface.
25 virtual void Display() override {} 25 virtual void Display() override {}
26 virtual void Error() override {} 26 virtual void Error() override {}
27 virtual void Close(bool by_user) override {} 27 virtual void Close(bool by_user) override {}
28 virtual void Click() override {} 28 virtual void Click() override {}
29 virtual std::string id() const override; 29 virtual std::string id() const override;
30 virtual content::WebContents* GetWebContents() const override;
31 30
32 private: 31 private:
33 virtual ~MockNotificationDelegate(); 32 virtual ~MockNotificationDelegate();
34 33
35 std::string id_; 34 std::string id_;
36 35
37 DISALLOW_COPY_AND_ASSIGN(MockNotificationDelegate); 36 DISALLOW_COPY_AND_ASSIGN(MockNotificationDelegate);
38 }; 37 };
39 38
40 // Mock implementation of Javascript object proxy which logs events that 39 // Mock implementation of Javascript object proxy which logs events that
(...skipping 22 matching lines...) Expand all
63 } 62 }
64 virtual void Close(bool by_user) override { 63 virtual void Close(bool by_user) override {
65 if (by_user) 64 if (by_user)
66 Logger::log("notification closed by user\n"); 65 Logger::log("notification closed by user\n");
67 else 66 else
68 Logger::log("notification closed by script\n"); 67 Logger::log("notification closed by script\n");
69 } 68 }
70 virtual std::string id() const override { 69 virtual std::string id() const override {
71 return notification_id_; 70 return notification_id_;
72 } 71 }
73 virtual content::WebContents* GetWebContents() const override {
74 return NULL;
75 }
76 72
77 private: 73 private:
78 std::string notification_id_; 74 std::string notification_id_;
79 75
80 DISALLOW_COPY_AND_ASSIGN(LoggingNotificationDelegate); 76 DISALLOW_COPY_AND_ASSIGN(LoggingNotificationDelegate);
81 }; 77 };
82 78
83 class StubNotificationUIManager : public NotificationUIManager { 79 class StubNotificationUIManager : public NotificationUIManager {
84 public: 80 public:
85 explicit StubNotificationUIManager(const GURL& welcome_origin); 81 explicit StubNotificationUIManager(const GURL& welcome_origin);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 DISALLOW_COPY_AND_ASSIGN(StubNotificationUIManager); 126 DISALLOW_COPY_AND_ASSIGN(StubNotificationUIManager);
131 Notification notification_; 127 Notification notification_;
132 Profile* profile_; 128 Profile* profile_;
133 std::string dismissed_id_; 129 std::string dismissed_id_;
134 GURL welcome_origin_; 130 GURL welcome_origin_;
135 bool welcomed_; 131 bool welcomed_;
136 size_t added_notifications_; 132 size_t added_notifications_;
137 }; 133 };
138 134
139 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_TEST_UTIL_H_ 135 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/notifications/notification_object_proxy.cc ('k') | chrome/browser/notifications/notification_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698