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/feature_list.h" |
10 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
11 #include "base/path_service.h" | 12 #include "base/path_service.h" |
12 #include "base/strings/string_piece.h" | 13 #include "base/strings/string_piece.h" |
13 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
14 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
15 #include "base/test/scoped_feature_list.h" | 16 #include "base/test/scoped_feature_list.h" |
16 #include "base/time/time.h" | 17 #include "base/time/time.h" |
17 #include "chrome/browser/notifications/desktop_notification_profile_util.h" | 18 #include "chrome/browser/notifications/desktop_notification_profile_util.h" |
18 #include "chrome/browser/notifications/message_center_display_service.h" | 19 #include "chrome/browser/notifications/message_center_display_service.h" |
19 #include "chrome/browser/notifications/notification.h" | 20 #include "chrome/browser/notifications/notification.h" |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 const Notification& notification = ui_manager()->GetNotificationAt(0); | 358 const Notification& notification = ui_manager()->GetNotificationAt(0); |
358 const std::vector<message_center::ButtonInfo>& buttons = | 359 const std::vector<message_center::ButtonInfo>& buttons = |
359 notification.buttons(); | 360 notification.buttons(); |
360 EXPECT_EQ(0u, buttons.size()); | 361 EXPECT_EQ(0u, buttons.size()); |
361 | 362 |
362 notification.delegate()->SettingsClick(); | 363 notification.delegate()->SettingsClick(); |
363 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); | 364 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); |
364 content::WebContents* web_contents = | 365 content::WebContents* web_contents = |
365 browser()->tab_strip_model()->GetActiveWebContents(); | 366 browser()->tab_strip_model()->GetActiveWebContents(); |
366 ASSERT_TRUE(content::WaitForLoadStop(web_contents)); | 367 ASSERT_TRUE(content::WaitForLoadStop(web_contents)); |
367 ASSERT_EQ("chrome://settings/contentExceptions#notifications", | 368 |
368 web_contents->GetLastCommittedURL().spec()); | 369 std::string url = web_contents->GetLastCommittedURL().spec(); |
| 370 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) |
| 371 ASSERT_EQ("chrome://settings/content/notifications", url); |
| 372 else |
| 373 ASSERT_EQ("chrome://settings/contentExceptions#notifications", url); |
369 } | 374 } |
370 | 375 |
371 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest, | 376 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest, |
372 WebNotificationOptionsVibrationPattern) { | 377 WebNotificationOptionsVibrationPattern) { |
373 ASSERT_NO_FATAL_FAILURE(GrantNotificationPermissionForTest()); | 378 ASSERT_NO_FATAL_FAILURE(GrantNotificationPermissionForTest()); |
374 | 379 |
375 std::string script_result; | 380 std::string script_result; |
376 ASSERT_TRUE(RunScript("DisplayPersistentNotificationVibrate()", | 381 ASSERT_TRUE(RunScript("DisplayPersistentNotificationVibrate()", |
377 &script_result)); | 382 &script_result)); |
378 EXPECT_EQ("ok", script_result); | 383 EXPECT_EQ("ok", script_result); |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 RunScript("DisplayPersistentAllOptionsNotification()", &script_result)); | 781 RunScript("DisplayPersistentAllOptionsNotification()", &script_result)); |
777 EXPECT_EQ("ok", script_result); | 782 EXPECT_EQ("ok", script_result); |
778 | 783 |
779 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); | 784 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); |
780 const Notification& notification = ui_manager()->GetNotificationAt(0); | 785 const Notification& notification = ui_manager()->GetNotificationAt(0); |
781 | 786 |
782 // Since the kNotificationContentImage kill switch has disabled images, the | 787 // Since the kNotificationContentImage kill switch has disabled images, the |
783 // notification should be shown without an image. | 788 // notification should be shown without an image. |
784 EXPECT_TRUE(notification.image().IsEmpty()); | 789 EXPECT_TRUE(notification.image().IsEmpty()); |
785 } | 790 } |
OLD | NEW |