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 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 const Notification& notification = ui_manager()->GetNotificationAt(0); | 217 const Notification& notification = ui_manager()->GetNotificationAt(0); |
218 notification.delegate()->Click(); | 218 notification.delegate()->Click(); |
219 | 219 |
220 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result)); | 220 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result)); |
221 EXPECT_EQ("action_none", script_result); | 221 EXPECT_EQ("action_none", script_result); |
222 | 222 |
223 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); | 223 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); |
224 } | 224 } |
225 | 225 |
226 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest, | 226 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest, |
| 227 WebNotificationOptionsReflection) { |
| 228 std::string script_result; |
| 229 |
| 230 // TODO(peter): It doesn't add much value if we use the InfoBarResponder for |
| 231 // each test. Rather, we should just toggle the content setting. |
| 232 InfoBarResponder accepting_responder(browser(), true); |
| 233 ASSERT_TRUE(RunScript("RequestPermission()", &script_result)); |
| 234 EXPECT_EQ("granted", script_result); |
| 235 |
| 236 ASSERT_TRUE(RunScript("DisplayPersistentAllOptionsNotification()", |
| 237 &script_result)); |
| 238 EXPECT_EQ("ok", script_result); |
| 239 |
| 240 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); |
| 241 |
| 242 // We don't use or check the notification's direction and language. |
| 243 const Notification& notification = ui_manager()->GetNotificationAt(0); |
| 244 EXPECT_EQ("Title", base::UTF16ToUTF8(notification.title())); |
| 245 EXPECT_EQ("Contents", base::UTF16ToUTF8(notification.message())); |
| 246 EXPECT_EQ("replace-id", base::UTF16ToUTF8(notification.replace_id())); |
| 247 EXPECT_FALSE(notification.icon().IsEmpty()); |
| 248 EXPECT_TRUE(notification.silent()); |
| 249 } |
| 250 |
| 251 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest, |
227 CloseDisplayedPersistentNotification) { | 252 CloseDisplayedPersistentNotification) { |
228 std::string script_result; | 253 std::string script_result; |
229 | 254 |
230 InfoBarResponder accepting_responder(browser(), true); | 255 InfoBarResponder accepting_responder(browser(), true); |
231 ASSERT_TRUE(RunScript("RequestPermission()", &script_result)); | 256 ASSERT_TRUE(RunScript("RequestPermission()", &script_result)); |
232 EXPECT_EQ("granted", script_result); | 257 EXPECT_EQ("granted", script_result); |
233 | 258 |
234 ASSERT_TRUE(RunScript("DisplayPersistentNotification('action_close')", | 259 ASSERT_TRUE(RunScript("DisplayPersistentNotification('action_close')", |
235 &script_result)); | 260 &script_result)); |
236 EXPECT_EQ("ok", script_result); | 261 EXPECT_EQ("ok", script_result); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 | 322 |
298 InfoBarResponder accepting_responder_file(browser(), true); | 323 InfoBarResponder accepting_responder_file(browser(), true); |
299 ASSERT_TRUE(RunScript("RequestPermission()", &script_result)); | 324 ASSERT_TRUE(RunScript("RequestPermission()", &script_result)); |
300 EXPECT_EQ("granted", script_result); | 325 EXPECT_EQ("granted", script_result); |
301 | 326 |
302 EXPECT_FALSE(notification_service->IsNotifierEnabled(file_notifier)) | 327 EXPECT_FALSE(notification_service->IsNotifierEnabled(file_notifier)) |
303 << "If this test fails, you may have fixed a bug preventing file origins " | 328 << "If this test fails, you may have fixed a bug preventing file origins " |
304 << "from sending their origin from Blink; if so you need to update the " | 329 << "from sending their origin from Blink; if so you need to update the " |
305 << "display function for notification origins to show the file path."; | 330 << "display function for notification origins to show the file path."; |
306 } | 331 } |
OLD | NEW |