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