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

Side by Side Diff: chrome/browser/notifications/platform_notification_service_interactive_uitest.cc

Issue 2151993002: [WebAPKs] Plumb service worker scope to notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into notification_scope Created 4 years, 5 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
OLDNEW
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 <memory> 5 #include <memory>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 402
403 net::HostPortPair host_port = ServerHostPort(); 403 net::HostPortPair host_port = ServerHostPort();
404 404
405 const Notification& notification = ui_manager()->GetNotificationAt(0); 405 const Notification& notification = ui_manager()->GetNotificationAt(0);
406 406
407 EXPECT_TRUE(notification.context_message().empty()); 407 EXPECT_TRUE(notification.context_message().empty());
408 EXPECT_EQ("https://" + host_port.ToString() + "/", 408 EXPECT_EQ("https://" + host_port.ToString() + "/",
409 notification.origin_url().spec()); 409 notification.origin_url().spec());
410 } 410 }
411 411
412 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest,
413 PersistentNotificationServiceWorkerScope) {
414 RequestAndAcceptPermission();
415
416 // Creates a simple notification.
417 std::string script_result;
418 ASSERT_TRUE(RunScript("DisplayPersistentNotification()", &script_result));
419
420 const Notification& notification = ui_manager()->GetNotificationAt(0);
421
422 EXPECT_EQ(TestPageUrl().spec(), notification.service_worker_scope().spec());
423 }
424
412 // TODO(felt): This DCHECKs when bubbles are enabled, when the file_url is 425 // TODO(felt): This DCHECKs when bubbles are enabled, when the file_url is
413 // persisted. crbug.com/502057 426 // persisted. crbug.com/502057
414 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest, 427 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest,
415 DISABLED_CheckFilePermissionNotGranted) { 428 DISABLED_CheckFilePermissionNotGranted) {
416 // This case should succeed because a normal page URL is used. 429 // This case should succeed because a normal page URL is used.
417 std::string script_result; 430 std::string script_result;
418 431
419 PermissionManager* permission_manager = 432 PermissionManager* permission_manager =
420 PermissionManager::Get(browser()->profile()); 433 PermissionManager::Get(browser()->profile());
421 434
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 EXPECT_EQ("actionTitle2", base::UTF16ToUTF8(notification.buttons()[1].title)); 519 EXPECT_EQ("actionTitle2", base::UTF16ToUTF8(notification.buttons()[1].title));
507 520
508 notification.delegate()->ButtonClick(0); 521 notification.delegate()->ButtonClick(0);
509 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result)); 522 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result));
510 EXPECT_EQ("action_button_click actionId1", script_result); 523 EXPECT_EQ("action_button_click actionId1", script_result);
511 524
512 notification.delegate()->ButtonClick(1); 525 notification.delegate()->ButtonClick(1);
513 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result)); 526 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result));
514 EXPECT_EQ("action_button_click actionId2", script_result); 527 EXPECT_EQ("action_button_click actionId2", script_result);
515 } 528 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698