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

Side by Side Diff: content/browser/notifications/notification_database_data_unittest.cc

Issue 1901133002: Move the notification constants to Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « content/browser/DEPS ('k') | content/browser/notifications/notification_message_filter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/strings/nullable_string16.h" 9 #include "base/strings/nullable_string16.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "content/browser/notifications/notification_database_data.pb.h" 13 #include "content/browser/notifications/notification_database_data.pb.h"
14 #include "content/browser/notifications/notification_database_data_conversions.h " 14 #include "content/browser/notifications/notification_database_data_conversions.h "
15 #include "content/common/notification_constants.h"
16 #include "content/public/browser/notification_database_data.h" 15 #include "content/public/browser/notification_database_data.h"
17 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati onConstants.h"
19 19
20 namespace content { 20 namespace content {
21 21
22 const int64_t kNotificationId = 42; 22 const int64_t kNotificationId = 42;
23 const int64_t kServiceWorkerRegistrationId = 9001; 23 const int64_t kServiceWorkerRegistrationId = 9001;
24 24
25 const PlatformNotificationActionType kNotificationActionType = 25 const PlatformNotificationActionType kNotificationActionType =
26 PLATFORM_NOTIFICATION_ACTION_TYPE_TEXT; 26 PLATFORM_NOTIFICATION_ACTION_TYPE_TEXT;
27 const char kOrigin[] = "https://example.com/"; 27 const char kOrigin[] = "https://example.com/";
28 const char kNotificationTitle[] = "My Notification"; 28 const char kNotificationTitle[] = "My Notification";
(...skipping 23 matching lines...) Expand all
52 notification_data.body = base::ASCIIToUTF16(kNotificationBody); 52 notification_data.body = base::ASCIIToUTF16(kNotificationBody);
53 notification_data.tag = kNotificationTag; 53 notification_data.tag = kNotificationTag;
54 notification_data.icon = GURL(kNotificationIconUrl); 54 notification_data.icon = GURL(kNotificationIconUrl);
55 notification_data.badge = GURL(kNotificationBadgeUrl); 55 notification_data.badge = GURL(kNotificationBadgeUrl);
56 notification_data.vibration_pattern = vibration_pattern; 56 notification_data.vibration_pattern = vibration_pattern;
57 notification_data.timestamp = base::Time::FromJsTime(kNotificationTimestamp); 57 notification_data.timestamp = base::Time::FromJsTime(kNotificationTimestamp);
58 notification_data.renotify = true; 58 notification_data.renotify = true;
59 notification_data.silent = true; 59 notification_data.silent = true;
60 notification_data.require_interaction = true; 60 notification_data.require_interaction = true;
61 notification_data.data = developer_data; 61 notification_data.data = developer_data;
62 for (size_t i = 0; i < kPlatformNotificationMaxActions; i++) { 62 for (size_t i = 0; i < blink::kWebNotificationMaxActions; i++) {
63 PlatformNotificationAction notification_action; 63 PlatformNotificationAction notification_action;
64 notification_action.type = kNotificationActionType; 64 notification_action.type = kNotificationActionType;
65 notification_action.action = base::SizeTToString(i); 65 notification_action.action = base::SizeTToString(i);
66 notification_action.title = base::SizeTToString16(i); 66 notification_action.title = base::SizeTToString16(i);
67 notification_action.icon = GURL(kNotificationActionIconUrl); 67 notification_action.icon = GURL(kNotificationActionIconUrl);
68 notification_action.placeholder = 68 notification_action.placeholder =
69 base::NullableString16(base::SizeTToString16(i), false); 69 base::NullableString16(base::SizeTToString16(i), false);
70 notification_data.actions.push_back(notification_action); 70 notification_data.actions.push_back(notification_action);
71 } 71 }
72 72
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 SerializeNotificationDatabaseData(database_data, &serialized_data)); 202 SerializeNotificationDatabaseData(database_data, &serialized_data));
203 203
204 NotificationDatabaseData copied_data; 204 NotificationDatabaseData copied_data;
205 ASSERT_TRUE( 205 ASSERT_TRUE(
206 DeserializeNotificationDatabaseData(serialized_data, &copied_data)); 206 DeserializeNotificationDatabaseData(serialized_data, &copied_data));
207 207
208 EXPECT_TRUE(copied_data.notification_data.actions[0].placeholder.is_null()); 208 EXPECT_TRUE(copied_data.notification_data.actions[0].placeholder.is_null());
209 } 209 }
210 210
211 } // namespace content 211 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/DEPS ('k') | content/browser/notifications/notification_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698