OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/notifications/notification.h" | 9 #include "chrome/browser/notifications/notification.h" |
10 #include "chrome/browser/notifications/notification_ui_manager.h" | 10 #include "chrome/browser/notifications/notification_ui_manager.h" |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 | 582 |
583 // Check the base fields of the notification. | 583 // Check the base fields of the notification. |
584 EXPECT_EQ(message_center::NOTIFICATION_TYPE_IMAGE, | 584 EXPECT_EQ(message_center::NOTIFICATION_TYPE_IMAGE, |
585 notification_manager.notification().type()); | 585 notification_manager.notification().type()); |
586 EXPECT_EQ(kTitle1, | 586 EXPECT_EQ(kTitle1, |
587 UTF16ToUTF8(notification_manager.notification().title())); | 587 UTF16ToUTF8(notification_manager.notification().title())); |
588 EXPECT_EQ(kText1, | 588 EXPECT_EQ(kText1, |
589 UTF16ToUTF8(notification_manager.notification().body())); | 589 UTF16ToUTF8(notification_manager.notification().body())); |
590 EXPECT_EQ(kExpectedOriginUrl, | 590 EXPECT_EQ(kExpectedOriginUrl, |
591 notification_manager.notification().origin_url().spec()); | 591 notification_manager.notification().origin_url().spec()); |
592 EXPECT_EQ(kIconUrl1, notification_manager.notification().icon_url().spec()); | |
593 EXPECT_EQ(kKey1, | 592 EXPECT_EQ(kKey1, |
594 UTF16ToUTF8(notification_manager.notification().replace_id())); | 593 UTF16ToUTF8(notification_manager.notification().replace_id())); |
595 const DictionaryValue* actual_fields = | 594 const DictionaryValue* actual_fields = |
596 notification_manager.notification().optional_fields(); | 595 notification_manager.notification().optional_fields(); |
597 | 596 |
598 // Check the optional fields of the notification. | 597 // Check the optional fields of the notification. |
599 // Make an optional fields struct like we expect, compare it with actual. | 598 // Make an optional fields struct like we expect, compare it with actual. |
600 DictionaryValue expected_fields; | 599 DictionaryValue expected_fields; |
601 expected_fields.SetDouble(message_center::kTimestampKey, kFakeCreationTime); | 600 expected_fields.SetDouble(message_center::kTimestampKey, kFakeCreationTime); |
602 expected_fields.SetInteger(message_center::kPriorityKey, | 601 expected_fields.SetInteger(message_center::kPriorityKey, |
(...skipping 29 matching lines...) Expand all Loading... |
632 items->Append(item3); | 631 items->Append(item3); |
633 expected_fields.Set(message_center::kItemsKey, items); | 632 expected_fields.Set(message_center::kItemsKey, items); |
634 | 633 |
635 EXPECT_TRUE(expected_fields.Equals(actual_fields)) | 634 EXPECT_TRUE(expected_fields.Equals(actual_fields)) |
636 << "Expected: " << expected_fields | 635 << "Expected: " << expected_fields |
637 << ", but actual: " << *actual_fields; | 636 << ", but actual: " << *actual_fields; |
638 | 637 |
639 } | 638 } |
640 | 639 |
641 // TODO(petewil): Add a test for a notification being read and or deleted. | 640 // TODO(petewil): Add a test for a notification being read and or deleted. |
OLD | NEW |