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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
317 const Notification& notification = ui_manager()->GetNotificationAt(0); | 317 const Notification& notification = ui_manager()->GetNotificationAt(0); |
318 notification.delegate()->Click(); | 318 notification.delegate()->Click(); |
319 | 319 |
320 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result)); | 320 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result)); |
321 EXPECT_EQ("action_close", script_result); | 321 EXPECT_EQ("action_close", script_result); |
322 | 322 |
323 ASSERT_EQ(0u, ui_manager()->GetNotificationCount()); | 323 ASSERT_EQ(0u, ui_manager()->GetNotificationCount()); |
324 } | 324 } |
325 | 325 |
326 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest, | 326 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest, |
327 UserClosesPersistentNotification) { | |
328 ASSERT_NO_FATAL_FAILURE(GrantNotificationPermissionForTest()); | |
329 | |
330 std::string script_result; | |
331 ASSERT_TRUE( | |
332 RunScript("DisplayPersistentNotification('close_test')", &script_result)); | |
333 EXPECT_EQ("ok", script_result); | |
334 | |
335 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); | |
336 const Notification& notification = ui_manager()->GetNotificationAt(0); | |
337 notification.delegate()->Close(true); | |
Peter Beverloo
2016/01/27 19:03:57
nit: "true /* by_user */"
Nina
2016/01/28 11:59:01
Done.
| |
338 | |
339 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result)); | |
340 EXPECT_EQ("closing notification: close_test", script_result); | |
341 } | |
342 | |
343 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest, | |
327 TestDisplayOriginContextMessage) { | 344 TestDisplayOriginContextMessage) { |
328 RequestAndAcceptPermission(); | 345 RequestAndAcceptPermission(); |
329 | 346 |
330 // Creates a simple notification. | 347 // Creates a simple notification. |
331 std::string script_result; | 348 std::string script_result; |
332 ASSERT_TRUE(RunScript("DisplayPersistentNotification()", &script_result)); | 349 ASSERT_TRUE(RunScript("DisplayPersistentNotification()", &script_result)); |
333 | 350 |
334 net::HostPortPair host_port = ServerHostPort(); | 351 net::HostPortPair host_port = ServerHostPort(); |
335 | 352 |
336 const Notification& notification = ui_manager()->GetNotificationAt(0); | 353 const Notification& notification = ui_manager()->GetNotificationAt(0); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
410 | 427 |
411 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); | 428 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); |
412 | 429 |
413 const Notification& notification = ui_manager()->GetNotificationAt(0); | 430 const Notification& notification = ui_manager()->GetNotificationAt(0); |
414 EXPECT_FALSE(notification.icon().IsEmpty()); | 431 EXPECT_FALSE(notification.icon().IsEmpty()); |
415 | 432 |
416 EXPECT_EQ("Blob Title", base::UTF16ToUTF8(notification.title())); | 433 EXPECT_EQ("Blob Title", base::UTF16ToUTF8(notification.title())); |
417 EXPECT_EQ(kIconWidth, notification.icon().Width()); | 434 EXPECT_EQ(kIconWidth, notification.icon().Width()); |
418 EXPECT_EQ(kIconHeight, notification.icon().Height()); | 435 EXPECT_EQ(kIconHeight, notification.icon().Height()); |
419 } | 436 } |
OLD | NEW |