| 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 "chrome/browser/notifications/notification_conversion_helper.h" | 5 #include "chrome/browser/notifications/notification_conversion_helper.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/notifications/notification.h" | 8 #include "chrome/browser/notifications/notification.h" |
| 9 #include "chrome/browser/notifications/notification_test_util.h" | 9 #include "chrome/browser/notifications/notification_test_util.h" |
| 10 #include "chrome/common/extensions/api/notifications.h" | 10 #include "chrome/common/extensions/api/notifications.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "third_party/skia/include/core/SkBitmap.h" | 12 #include "third_party/skia/include/core/SkBitmap.h" |
| 13 #include "ui/message_center/notification.h" | 13 #include "ui/message_center/notification.h" |
| 14 #include "ui/message_center/notification_types.h" | 14 #include "ui/message_center/notification_types.h" |
| 15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 16 | 16 |
| 17 class NotificationConversionHelperTest : public testing::Test { | 17 class NotificationConversionHelperTest : public testing::Test { |
| 18 public: | 18 public: |
| 19 NotificationConversionHelperTest() {} | 19 NotificationConversionHelperTest() {} |
| 20 | 20 |
| 21 virtual void SetUp() OVERRIDE {} | 21 virtual void SetUp() override {} |
| 22 | 22 |
| 23 virtual void TearDown() OVERRIDE {} | 23 virtual void TearDown() override {} |
| 24 | 24 |
| 25 protected: | 25 protected: |
| 26 scoped_ptr<Notification> CreateNotification( | 26 scoped_ptr<Notification> CreateNotification( |
| 27 message_center::NotificationType type) { | 27 message_center::NotificationType type) { |
| 28 message_center::RichNotificationData optional_fields; | 28 message_center::RichNotificationData optional_fields; |
| 29 optional_fields.priority = 1; | 29 optional_fields.priority = 1; |
| 30 optional_fields.context_message = | 30 optional_fields.context_message = |
| 31 base::UTF8ToUTF16("I am a context message."); | 31 base::UTF8ToUTF16("I am a context message."); |
| 32 optional_fields.timestamp = base::Time::FromDoubleT(12345678.9); | 32 optional_fields.timestamp = base::Time::FromDoubleT(12345678.9); |
| 33 optional_fields.buttons.push_back( | 33 optional_fields.buttons.push_back( |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 scoped_ptr<extensions::api::notifications::NotificationOptions> options3( | 117 scoped_ptr<extensions::api::notifications::NotificationOptions> options3( |
| 118 new extensions::api::notifications::NotificationOptions()); | 118 new extensions::api::notifications::NotificationOptions()); |
| 119 NotificationConversionHelper::NotificationToNotificationOptions( | 119 NotificationConversionHelper::NotificationToNotificationOptions( |
| 120 *(notification3), options3.get()); | 120 *(notification3), options3.get()); |
| 121 EXPECT_EQ(options3->type, extensions::api::notifications::TEMPLATE_TYPE_LIST); | 121 EXPECT_EQ(options3->type, extensions::api::notifications::TEMPLATE_TYPE_LIST); |
| 122 EXPECT_EQ(options3->items->at(0)->title, "Item 1 Title"); | 122 EXPECT_EQ(options3->items->at(0)->title, "Item 1 Title"); |
| 123 EXPECT_EQ(options3->items->at(0)->message, "Item 1 Message"); | 123 EXPECT_EQ(options3->items->at(0)->message, "Item 1 Message"); |
| 124 EXPECT_EQ(options3->items->at(1)->title, "Item 2 Title"); | 124 EXPECT_EQ(options3->items->at(1)->title, "Item 2 Title"); |
| 125 EXPECT_EQ(options3->items->at(1)->message, "Item 2 Message"); | 125 EXPECT_EQ(options3->items->at(1)->message, "Item 2 Message"); |
| 126 } | 126 } |
| OLD | NEW |