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

Side by Side Diff: chrome/browser/notifications/notification_browsertest.cc

Issue 667283002: Standardize usage of virtual/override/final in chrome/browser/notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 #include <deque> 5 #include <deque>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 class MessageCenterChangeObserver 66 class MessageCenterChangeObserver
67 : public message_center::MessageCenterObserver, 67 : public message_center::MessageCenterObserver,
68 public NotificationChangeObserver { 68 public NotificationChangeObserver {
69 public: 69 public:
70 MessageCenterChangeObserver() 70 MessageCenterChangeObserver()
71 : notification_received_(false) { 71 : notification_received_(false) {
72 message_center::MessageCenter::Get()->AddObserver(this); 72 message_center::MessageCenter::Get()->AddObserver(this);
73 } 73 }
74 74
75 virtual ~MessageCenterChangeObserver() { 75 ~MessageCenterChangeObserver() override {
76 message_center::MessageCenter::Get()->RemoveObserver(this); 76 message_center::MessageCenter::Get()->RemoveObserver(this);
77 } 77 }
78 78
79 // NotificationChangeObserver: 79 // NotificationChangeObserver:
80 virtual bool Wait() override { 80 bool Wait() override {
81 if (notification_received_) 81 if (notification_received_)
82 return true; 82 return true;
83 83
84 message_loop_runner_ = new content::MessageLoopRunner; 84 message_loop_runner_ = new content::MessageLoopRunner;
85 message_loop_runner_->Run(); 85 message_loop_runner_->Run();
86 return notification_received_; 86 return notification_received_;
87 } 87 }
88 88
89 // message_center::MessageCenterObserver: 89 // message_center::MessageCenterObserver:
90 virtual void OnNotificationAdded( 90 void OnNotificationAdded(const std::string& notification_id) override {
91 const std::string& notification_id) override {
92 OnMessageCenterChanged(); 91 OnMessageCenterChanged();
93 } 92 }
94 93
95 virtual void OnNotificationRemoved(const std::string& notification_id, 94 void OnNotificationRemoved(const std::string& notification_id,
96 bool by_user) override { 95 bool by_user) override {
97 OnMessageCenterChanged(); 96 OnMessageCenterChanged();
98 } 97 }
99 98
100 virtual void OnNotificationUpdated( 99 void OnNotificationUpdated(const std::string& notification_id) override {
101 const std::string& notification_id) override {
102 OnMessageCenterChanged(); 100 OnMessageCenterChanged();
103 } 101 }
104 102
105 void OnMessageCenterChanged() { 103 void OnMessageCenterChanged() {
106 notification_received_ = true; 104 notification_received_ = true;
107 if (message_loop_runner_.get()) 105 if (message_loop_runner_.get())
108 message_loop_runner_->Quit(); 106 message_loop_runner_->Quit();
109 } 107 }
110 108
111 bool notification_received_; 109 bool notification_received_;
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 (*notifications.rbegin())->id()); 830 (*notifications.rbegin())->id());
833 831
834 ASSERT_EQ(0, GetNotificationPopupCount()); 832 ASSERT_EQ(0, GetNotificationPopupCount());
835 833
836 result = CreateNotification( 834 result = CreateNotification(
837 browser(), true, "abc.png", "Title2", "Body2", "chat"); 835 browser(), true, "abc.png", "Title2", "Body2", "chat");
838 EXPECT_NE("-1", result); 836 EXPECT_NE("-1", result);
839 837
840 ASSERT_EQ(1, GetNotificationPopupCount()); 838 ASSERT_EQ(1, GetNotificationPopupCount());
841 } 839 }
OLDNEW
« no previous file with comments | « chrome/browser/notifications/notification.h ('k') | chrome/browser/notifications/notification_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698