| 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 <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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 void PlatformNotificationServiceBrowserTest::TearDown() { | 134 void PlatformNotificationServiceBrowserTest::TearDown() { |
| 135 service()->SetNotificationDisplayServiceForTesting(nullptr); | 135 service()->SetNotificationDisplayServiceForTesting(nullptr); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void PlatformNotificationServiceBrowserTest:: | 138 void PlatformNotificationServiceBrowserTest:: |
| 139 GrantNotificationPermissionForTest() const { | 139 GrantNotificationPermissionForTest() const { |
| 140 GURL origin = TestPageUrl().GetOrigin(); | 140 GURL origin = TestPageUrl().GetOrigin(); |
| 141 | 141 |
| 142 DesktopNotificationProfileUtil::GrantPermission(browser()->profile(), origin); | 142 DesktopNotificationProfileUtil::GrantPermission(browser()->profile(), origin); |
| 143 ASSERT_EQ(CONTENT_SETTING_ALLOW, | 143 ASSERT_EQ(blink::mojom::PermissionStatus::GRANTED, |
| 144 DesktopNotificationProfileUtil::GetContentSetting( | 144 PermissionManager::Get(browser()->profile()) |
| 145 browser()->profile(), origin)); | 145 ->GetPermissionStatus(content::PermissionType::NOTIFICATIONS, |
| 146 origin, origin)); |
| 146 } | 147 } |
| 147 | 148 |
| 148 void PlatformNotificationServiceBrowserTest::NavigateToTestPage( | 149 void PlatformNotificationServiceBrowserTest::NavigateToTestPage( |
| 149 const std::string& path) const { | 150 const std::string& path) const { |
| 150 ui_test_utils::NavigateToURL(browser(), https_server_->GetURL(path)); | 151 ui_test_utils::NavigateToURL(browser(), https_server_->GetURL(path)); |
| 151 } | 152 } |
| 152 | 153 |
| 153 bool PlatformNotificationServiceBrowserTest::RunScript( | 154 bool PlatformNotificationServiceBrowserTest::RunScript( |
| 154 const std::string& script, std::string* result) const { | 155 const std::string& script, std::string* result) const { |
| 155 return content::ExecuteScriptAndExtractString( | 156 return content::ExecuteScriptAndExtractString( |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 EXPECT_EQ("actionTitle2", base::UTF16ToUTF8(notification.buttons()[1].title)); | 486 EXPECT_EQ("actionTitle2", base::UTF16ToUTF8(notification.buttons()[1].title)); |
| 486 | 487 |
| 487 notification.delegate()->ButtonClick(0); | 488 notification.delegate()->ButtonClick(0); |
| 488 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result)); | 489 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result)); |
| 489 EXPECT_EQ("action_button_click actionId1", script_result); | 490 EXPECT_EQ("action_button_click actionId1", script_result); |
| 490 | 491 |
| 491 notification.delegate()->ButtonClick(1); | 492 notification.delegate()->ButtonClick(1); |
| 492 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result)); | 493 ASSERT_TRUE(RunScript("GetMessageFromWorker()", &script_result)); |
| 493 EXPECT_EQ("action_button_click actionId2", script_result); | 494 EXPECT_EQ("action_button_click actionId2", script_result); |
| 494 } | 495 } |
| OLD | NEW |