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

Unified Diff: ui/message_center/views/message_center_view_unittest.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 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
« no previous file with comments | « ui/message_center/views/message_center_view.cc ('k') | ui/message_center/views/message_popup_collection.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/views/message_center_view_unittest.cc
diff --git a/ui/message_center/views/message_center_view_unittest.cc b/ui/message_center/views/message_center_view_unittest.cc
index 1d592a3312c9f6911fb6616f1f91310f46f30d7e..a150a69015438904652f38a556cd135dcea39962 100644
--- a/ui/message_center/views/message_center_view_unittest.cc
+++ b/ui/message_center/views/message_center_view_unittest.cc
@@ -5,11 +5,11 @@
#include "ui/message_center/views/message_center_view.h"
#include <map>
+#include <memory>
#include <utility>
#include "base/logging.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/message_center/fake_message_center.h"
@@ -130,15 +130,15 @@ class MessageCenterViewTest : public testing::Test,
int GetNotificationCount();
int GetCallCount(CallType type);
int GetCalculatedMessageListViewHeight();
- void AddNotification(scoped_ptr<Notification> notification);
+ void AddNotification(std::unique_ptr<Notification> notification);
void UpdateNotification(const std::string& notification_id,
- scoped_ptr<Notification> notification);
+ std::unique_ptr<Notification> notification);
- // Overridden from MessageCenterController:
+ // Overridden from MessageCenterController:
void ClickOnNotification(const std::string& notification_id) override;
void RemoveNotification(const std::string& notification_id,
bool by_user) override;
- scoped_ptr<ui::MenuModel> CreateMenuModel(
+ std::unique_ptr<ui::MenuModel> CreateMenuModel(
const NotifierId& notifier_id,
const base::string16& display_source) override;
bool HasClickedListener(const std::string& notification_id) override;
@@ -161,8 +161,8 @@ class MessageCenterViewTest : public testing::Test,
base::MessageLoopForUI message_loop_;
NotificationList::Notifications notifications_;
- scoped_ptr<MessageCenterView> message_center_view_;
- scoped_ptr<FakeMessageCenterImpl> message_center_;
+ std::unique_ptr<MessageCenterView> message_center_view_;
+ std::unique_ptr<FakeMessageCenterImpl> message_center_;
std::map<CallType,int> callCounts_;
DISALLOW_COPY_AND_ASSIGN(MessageCenterViewTest);
@@ -255,7 +255,7 @@ void MessageCenterViewTest::ClickOnNotification(
}
void MessageCenterViewTest::AddNotification(
- scoped_ptr<Notification> notification) {
+ std::unique_ptr<Notification> notification) {
std::string notification_id = notification->id();
notifications_.insert(notification.release());
message_center_->SetVisibleNotifications(notifications_);
@@ -264,7 +264,7 @@ void MessageCenterViewTest::AddNotification(
void MessageCenterViewTest::UpdateNotification(
const std::string& notification_id,
- scoped_ptr<Notification> notification) {
+ std::unique_ptr<Notification> notification) {
for (auto it = notifications_.begin(); it != notifications_.end(); it++) {
if ((*it)->id() == notification_id) {
delete *it;
@@ -293,7 +293,7 @@ void MessageCenterViewTest::RemoveNotification(
message_center_view_->OnNotificationRemoved(notification_id, by_user);
}
-scoped_ptr<ui::MenuModel> MessageCenterViewTest::CreateMenuModel(
+std::unique_ptr<ui::MenuModel> MessageCenterViewTest::CreateMenuModel(
const NotifierId& notifier_id,
const base::string16& display_source) {
// For this test, this method should not be invoked.
@@ -382,7 +382,7 @@ TEST_F(MessageCenterViewTest, SizeAfterUpdate) {
int width =
GetMessageListView()->width() - GetMessageListView()->GetInsets().width();
- scoped_ptr<Notification> notification(new Notification(
+ std::unique_ptr<Notification> notification(new Notification(
NOTIFICATION_TYPE_SIMPLE, std::string(kNotificationId2),
base::UTF8ToUTF16("title2"),
base::UTF8ToUTF16("message\nwhich\nis\nvertically\nlong\n."),
@@ -450,7 +450,7 @@ TEST_F(MessageCenterViewTest, PositionAfterUpdate) {
GetMessageListView()->SetRepositionTargetForTest(
GetNotificationView(kNotificationId1)->bounds());
- scoped_ptr<Notification> notification(new Notification(
+ std::unique_ptr<Notification> notification(new Notification(
NOTIFICATION_TYPE_SIMPLE, std::string(kNotificationId2),
base::UTF8ToUTF16("title2"),
base::UTF8ToUTF16("message\nwhich\nis\nvertically\nlong\n."),
@@ -565,14 +565,14 @@ TEST_F(MessageCenterViewTest, CloseButtonEnablity) {
pinned_notification.set_pinned(true);
AddNotification(
- scoped_ptr<Notification>(new Notification(normal_notification)));
+ std::unique_ptr<Notification>(new Notification(normal_notification)));
// There should be 1 non-pinned notification.
EXPECT_EQ(1u, GetMessageCenter()->GetVisibleNotifications().size());
EXPECT_TRUE(close_button->enabled());
AddNotification(
- scoped_ptr<Notification>(new Notification(pinned_notification)));
+ std::unique_ptr<Notification>(new Notification(pinned_notification)));
// There should be 1 normal notification and 1 pinned notification.
EXPECT_EQ(2u, GetMessageCenter()->GetVisibleNotifications().size());
@@ -591,7 +591,7 @@ TEST_F(MessageCenterViewTest, CloseButtonEnablity) {
EXPECT_FALSE(close_button->enabled());
AddNotification(
- scoped_ptr<Notification>(new Notification(pinned_notification)));
+ std::unique_ptr<Notification>(new Notification(pinned_notification)));
// There should be 1 pinned notification.
EXPECT_EQ(1u, GetMessageCenter()->GetVisibleNotifications().size());
« no previous file with comments | « ui/message_center/views/message_center_view.cc ('k') | ui/message_center/views/message_popup_collection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698