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

Unified Diff: chrome/browser/notifications/platform_notification_service_unittest.cc

Issue 1634933006: Use NotificationResources instead of a bare SkBitmap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit tests. Created 4 years, 11 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
Index: chrome/browser/notifications/platform_notification_service_unittest.cc
diff --git a/chrome/browser/notifications/platform_notification_service_unittest.cc b/chrome/browser/notifications/platform_notification_service_unittest.cc
index d8b2e011931a8648b9ac005a995b6a702cf26436..7e53f527a09d650526855e43f0a3084a390b2c0e 100644
--- a/chrome/browser/notifications/platform_notification_service_unittest.cc
+++ b/chrome/browser/notifications/platform_notification_service_unittest.cc
@@ -18,11 +18,11 @@
#include "chrome/test/base/testing_profile.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "content/public/browser/desktop_notification_delegate.h"
+#include "content/public/common/notification_resources.h"
#include "content/public/common/platform_notification_data.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/skia/include/core/SkBitmap.h"
#if defined(ENABLE_EXTENSIONS)
#include "base/command_line.h"
@@ -42,6 +42,9 @@
#include "chrome/browser/chromeos/settings/device_settings_service.h"
#endif
+using content::NotificationResources;
+using content::PlatformNotificationData;
+
namespace {
const int kNotificationVibrationPattern[] = { 100, 200, 300 };
@@ -102,19 +105,16 @@ class PlatformNotificationServiceTest : public testing::Test {
// The close closure may be specified if so desired.
MockDesktopNotificationDelegate* CreateSimplePageNotificationWithCloseClosure(
base::Closure* close_closure) const {
- content::PlatformNotificationData notification_data;
+ PlatformNotificationData notification_data;
notification_data.title = base::ASCIIToUTF16("My Notification");
notification_data.body = base::ASCIIToUTF16("Hello, world!");
MockDesktopNotificationDelegate* delegate =
new MockDesktopNotificationDelegate();
- service()->DisplayNotification(profile(),
- GURL("https://chrome.com/"),
- SkBitmap(),
- notification_data,
- make_scoped_ptr(delegate),
- close_closure);
+ service()->DisplayNotification(profile(), GURL("https://chrome.com/"),
+ notification_data, NotificationResources(),
+ make_scoped_ptr(delegate), close_closure);
return delegate;
}
@@ -163,13 +163,13 @@ TEST_F(PlatformNotificationServiceTest, DisplayPageCloseClosure) {
// the notification delegate ids.
#if !defined(OS_ANDROID)
TEST_F(PlatformNotificationServiceTest, PersistentNotificationDisplay) {
- content::PlatformNotificationData notification_data;
+ PlatformNotificationData notification_data;
notification_data.title = base::ASCIIToUTF16("My notification's title");
notification_data.body = base::ASCIIToUTF16("Hello, world!");
service()->DisplayPersistentNotification(
profile(), kPersistentNotificationId, GURL("https://chrome.com/"),
- SkBitmap(), notification_data);
+ notification_data, NotificationResources());
ASSERT_EQ(1u, ui_manager()->GetNotificationCount());
@@ -190,7 +190,7 @@ TEST_F(PlatformNotificationServiceTest, DisplayPageNotificationMatches) {
kNotificationVibrationPattern,
kNotificationVibrationPattern + arraysize(kNotificationVibrationPattern));
- content::PlatformNotificationData notification_data;
+ PlatformNotificationData notification_data;
notification_data.title = base::ASCIIToUTF16("My notification's title");
notification_data.body = base::ASCIIToUTF16("Hello, world!");
notification_data.vibration_pattern = vibration_pattern;
@@ -198,12 +198,9 @@ TEST_F(PlatformNotificationServiceTest, DisplayPageNotificationMatches) {
MockDesktopNotificationDelegate* delegate
= new MockDesktopNotificationDelegate();
- service()->DisplayNotification(profile(),
- GURL("https://chrome.com/"),
- SkBitmap(),
- notification_data,
- make_scoped_ptr(delegate),
- nullptr);
+ service()->DisplayNotification(profile(), GURL("https://chrome.com/"),
+ notification_data, NotificationResources(),
+ make_scoped_ptr(delegate), nullptr);
ASSERT_EQ(1u, ui_manager()->GetNotificationCount());
@@ -225,7 +222,7 @@ TEST_F(PlatformNotificationServiceTest, DisplayPersistentNotificationMatches) {
kNotificationVibrationPattern,
kNotificationVibrationPattern + arraysize(kNotificationVibrationPattern));
- content::PlatformNotificationData notification_data;
+ PlatformNotificationData notification_data;
notification_data.title = base::ASCIIToUTF16("My notification's title");
notification_data.body = base::ASCIIToUTF16("Hello, world!");
notification_data.vibration_pattern = vibration_pattern;
@@ -236,7 +233,7 @@ TEST_F(PlatformNotificationServiceTest, DisplayPersistentNotificationMatches) {
service()->DisplayPersistentNotification(
profile(), 0u /* persistent notification */, GURL("https://chrome.com/"),
- SkBitmap(), notification_data);
+ notification_data, NotificationResources());
ASSERT_EQ(1u, ui_manager()->GetNotificationCount());
@@ -273,8 +270,8 @@ TEST_F(PlatformNotificationServiceTest, NotificationPermissionLastUsage) {
base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(1));
service()->DisplayPersistentNotification(
- profile(), 42 /* sw_registration_id */, origin, SkBitmap(),
- content::PlatformNotificationData());
+ profile(), 42 /* sw_registration_id */, origin,
+ PlatformNotificationData(), NotificationResources());
base::Time after_persistent_notification =
HostContentSettingsMapFactory::GetForProfile(profile())->GetLastUsage(
@@ -369,13 +366,13 @@ TEST_F(PlatformNotificationServiceTest, ExtensionPermissionChecks) {
}
TEST_F(PlatformNotificationServiceTest, CreateNotificationFromData) {
- content::PlatformNotificationData notification_data;
+ PlatformNotificationData notification_data;
notification_data.title = base::ASCIIToUTF16("My Notification");
notification_data.body = base::ASCIIToUTF16("Hello, world!");
Notification notification = service()->CreateNotificationFromData(
- profile(), GURL("https://chrome.com/"), SkBitmap(), notification_data,
- new MockNotificationDelegate("hello"));
+ profile(), GURL("https://chrome.com/"), notification_data,
+ NotificationResources(), new MockNotificationDelegate("hello"));
EXPECT_TRUE(notification.context_message().empty());
// Create a mocked extension.
@@ -396,7 +393,8 @@ TEST_F(PlatformNotificationServiceTest, CreateNotificationFromData) {
notification = service()->CreateNotificationFromData(
profile(),
GURL("chrome-extension://honijodknafkokifofgiaalefdiedpko/main.html"),
- SkBitmap(), notification_data, new MockNotificationDelegate("hello"));
+ notification_data, NotificationResources(),
+ new MockNotificationDelegate("hello"));
EXPECT_EQ("NotificationTest",
base::UTF16ToUTF8(notification.context_message()));
}

Powered by Google App Engine
This is Rietveld 408576698