| 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 EXPECT_EQ("ok", script_result); | 229 EXPECT_EQ("ok", script_result); |
| 230 | 230 |
| 231 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); | 231 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); |
| 232 | 232 |
| 233 // We don't use or check the notification's direction and language. | 233 // We don't use or check the notification's direction and language. |
| 234 const Notification& default_notification = ui_manager()->GetNotificationAt(0); | 234 const Notification& default_notification = ui_manager()->GetNotificationAt(0); |
| 235 EXPECT_EQ("Some title", base::UTF16ToUTF8(default_notification.title())); | 235 EXPECT_EQ("Some title", base::UTF16ToUTF8(default_notification.title())); |
| 236 EXPECT_EQ("", base::UTF16ToUTF8(default_notification.message())); | 236 EXPECT_EQ("", base::UTF16ToUTF8(default_notification.message())); |
| 237 EXPECT_EQ("", default_notification.tag()); | 237 EXPECT_EQ("", default_notification.tag()); |
| 238 EXPECT_TRUE(default_notification.icon().IsEmpty()); | 238 EXPECT_TRUE(default_notification.icon().IsEmpty()); |
| 239 EXPECT_FALSE(default_notification.renotify()); |
| 239 EXPECT_FALSE(default_notification.silent()); | 240 EXPECT_FALSE(default_notification.silent()); |
| 240 EXPECT_FALSE(default_notification.never_timeout()); | 241 EXPECT_FALSE(default_notification.never_timeout()); |
| 241 | 242 |
| 242 // Verifies that the notification's default timestamp is set in the last 30 | 243 // Verifies that the notification's default timestamp is set in the last 30 |
| 243 // seconds. This number has no significance, but it needs to be significantly | 244 // seconds. This number has no significance, but it needs to be significantly |
| 244 // high to avoid flakiness in the test. | 245 // high to avoid flakiness in the test. |
| 245 EXPECT_NEAR(default_notification.timestamp().ToJsTime(), | 246 EXPECT_NEAR(default_notification.timestamp().ToJsTime(), |
| 246 base::Time::Now().ToJsTime(), 30 * 1000); | 247 base::Time::Now().ToJsTime(), 30 * 1000); |
| 247 | 248 |
| 248 // Now, test the non-default values. | 249 // Now, test the non-default values. |
| 249 | 250 |
| 250 ASSERT_TRUE(RunScript("DisplayPersistentAllOptionsNotification()", | 251 ASSERT_TRUE(RunScript("DisplayPersistentAllOptionsNotification()", |
| 251 &script_result)); | 252 &script_result)); |
| 252 EXPECT_EQ("ok", script_result); | 253 EXPECT_EQ("ok", script_result); |
| 253 | 254 |
| 254 ASSERT_EQ(2u, ui_manager()->GetNotificationCount()); | 255 ASSERT_EQ(2u, ui_manager()->GetNotificationCount()); |
| 255 | 256 |
| 256 // We don't use or check the notification's direction and language. | 257 // We don't use or check the notification's direction and language. |
| 257 const Notification& all_options_notification = | 258 const Notification& all_options_notification = |
| 258 ui_manager()->GetNotificationAt(1); | 259 ui_manager()->GetNotificationAt(1); |
| 259 EXPECT_EQ("Title", base::UTF16ToUTF8(all_options_notification.title())); | 260 EXPECT_EQ("Title", base::UTF16ToUTF8(all_options_notification.title())); |
| 260 EXPECT_EQ("Contents", base::UTF16ToUTF8(all_options_notification.message())); | 261 EXPECT_EQ("Contents", base::UTF16ToUTF8(all_options_notification.message())); |
| 261 EXPECT_EQ("replace-id", all_options_notification.tag()); | 262 EXPECT_EQ("replace-id", all_options_notification.tag()); |
| 262 EXPECT_FALSE(all_options_notification.icon().IsEmpty()); | 263 EXPECT_FALSE(all_options_notification.icon().IsEmpty()); |
| 264 EXPECT_TRUE(all_options_notification.renotify()); |
| 263 EXPECT_TRUE(all_options_notification.silent()); | 265 EXPECT_TRUE(all_options_notification.silent()); |
| 264 EXPECT_TRUE(all_options_notification.never_timeout()); | 266 EXPECT_TRUE(all_options_notification.never_timeout()); |
| 265 EXPECT_DOUBLE_EQ(kNotificationTimestamp, | 267 EXPECT_DOUBLE_EQ(kNotificationTimestamp, |
| 266 all_options_notification.timestamp().ToJsTime()); | 268 all_options_notification.timestamp().ToJsTime()); |
| 267 | 269 |
| 268 EXPECT_EQ(kIconWidth, all_options_notification.icon().Width()); | 270 EXPECT_EQ(kIconWidth, all_options_notification.icon().Width()); |
| 269 EXPECT_EQ(kIconHeight, all_options_notification.icon().Height()); | 271 EXPECT_EQ(kIconHeight, all_options_notification.icon().Height()); |
| 270 } | 272 } |
| 271 | 273 |
| 272 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest, | 274 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest, |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 | 439 |
| 438 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); | 440 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); |
| 439 | 441 |
| 440 const Notification& notification = ui_manager()->GetNotificationAt(0); | 442 const Notification& notification = ui_manager()->GetNotificationAt(0); |
| 441 EXPECT_FALSE(notification.icon().IsEmpty()); | 443 EXPECT_FALSE(notification.icon().IsEmpty()); |
| 442 | 444 |
| 443 EXPECT_EQ("Blob Title", base::UTF16ToUTF8(notification.title())); | 445 EXPECT_EQ("Blob Title", base::UTF16ToUTF8(notification.title())); |
| 444 EXPECT_EQ(kIconWidth, notification.icon().Width()); | 446 EXPECT_EQ(kIconWidth, notification.icon().Width()); |
| 445 EXPECT_EQ(kIconHeight, notification.icon().Height()); | 447 EXPECT_EQ(kIconHeight, notification.icon().Height()); |
| 446 } | 448 } |
| OLD | NEW |