| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/message_center/views/notification_view.h" | 5 #include "ui/message_center/views/notification_view.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 void ClickOnNotification(const std::string& notification_id) override; | 87 void ClickOnNotification(const std::string& notification_id) override; |
| 88 void RemoveNotification(const std::string& notification_id, | 88 void RemoveNotification(const std::string& notification_id, |
| 89 bool by_user) override; | 89 bool by_user) override; |
| 90 std::unique_ptr<ui::MenuModel> CreateMenuModel( | 90 std::unique_ptr<ui::MenuModel> CreateMenuModel( |
| 91 const NotifierId& notifier_id, | 91 const NotifierId& notifier_id, |
| 92 const base::string16& display_source) override; | 92 const base::string16& display_source) override; |
| 93 bool HasClickedListener(const std::string& notification_id) override; | 93 bool HasClickedListener(const std::string& notification_id) override; |
| 94 void ClickOnNotificationButton(const std::string& notification_id, | 94 void ClickOnNotificationButton(const std::string& notification_id, |
| 95 int button_index) override; | 95 int button_index) override; |
| 96 void ClickOnSettingsButton(const std::string& notification_id) override; | 96 void ClickOnSettingsButton(const std::string& notification_id) override; |
| 97 void UpdateNotificationSize(const std::string& notification_id) override; |
| 97 | 98 |
| 98 protected: | 99 protected: |
| 99 // Used to fill bitmaps returned by CreateBitmap(). | 100 // Used to fill bitmaps returned by CreateBitmap(). |
| 100 static const SkColor kBitmapColor = SK_ColorGREEN; | 101 static const SkColor kBitmapColor = SK_ColorGREEN; |
| 101 | 102 |
| 102 const gfx::Image CreateTestImage(int width, int height) { | 103 const gfx::Image CreateTestImage(int width, int height) { |
| 103 return gfx::Image::CreateFrom1xBitmap(CreateBitmap(width, height)); | 104 return gfx::Image::CreateFrom1xBitmap(CreateBitmap(width, height)); |
| 104 } | 105 } |
| 105 | 106 |
| 106 const SkBitmap CreateBitmap(int width, int height) { | 107 const SkBitmap CreateBitmap(int width, int height) { |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 // For this test, this method should not be invoked. | 279 // For this test, this method should not be invoked. |
| 279 NOTREACHED(); | 280 NOTREACHED(); |
| 280 } | 281 } |
| 281 | 282 |
| 282 void NotificationViewTest::ClickOnSettingsButton( | 283 void NotificationViewTest::ClickOnSettingsButton( |
| 283 const std::string& notification_id) { | 284 const std::string& notification_id) { |
| 284 // For this test, this method should not be invoked. | 285 // For this test, this method should not be invoked. |
| 285 NOTREACHED(); | 286 NOTREACHED(); |
| 286 } | 287 } |
| 287 | 288 |
| 289 void NotificationViewTest::UpdateNotificationSize( |
| 290 const std::string& notification_id) { |
| 291 // For this test, this method should not be invoked. |
| 292 NOTREACHED(); |
| 293 } |
| 294 |
| 288 /* Unit tests *****************************************************************/ | 295 /* Unit tests *****************************************************************/ |
| 289 | 296 |
| 290 TEST_F(NotificationViewTest, CreateOrUpdateTest) { | 297 TEST_F(NotificationViewTest, CreateOrUpdateTest) { |
| 291 EXPECT_TRUE(NULL != notification_view()->title_view_); | 298 EXPECT_TRUE(NULL != notification_view()->title_view_); |
| 292 EXPECT_TRUE(NULL != notification_view()->message_view_); | 299 EXPECT_TRUE(NULL != notification_view()->message_view_); |
| 293 EXPECT_TRUE(NULL != notification_view()->icon_view_); | 300 EXPECT_TRUE(NULL != notification_view()->icon_view_); |
| 294 EXPECT_TRUE(NULL != notification_view()->image_view_); | 301 EXPECT_TRUE(NULL != notification_view()->image_view_); |
| 295 | 302 |
| 296 notification()->set_image(gfx::Image()); | 303 notification()->set_image(gfx::Image()); |
| 297 notification()->set_title(base::ASCIIToUTF16("")); | 304 notification()->set_title(base::ASCIIToUTF16("")); |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 TEST_F(NotificationViewTest, Pinned) { | 711 TEST_F(NotificationViewTest, Pinned) { |
| 705 notification()->set_pinned(true); | 712 notification()->set_pinned(true); |
| 706 | 713 |
| 707 UpdateNotificationViews(); | 714 UpdateNotificationViews(); |
| 708 EXPECT_EQ(NULL, GetCloseButton()); | 715 EXPECT_EQ(NULL, GetCloseButton()); |
| 709 } | 716 } |
| 710 | 717 |
| 711 #endif // defined(OS_CHROMEOS) | 718 #endif // defined(OS_CHROMEOS) |
| 712 | 719 |
| 713 } // namespace message_center | 720 } // namespace message_center |
| OLD | NEW |