Chromium Code Reviews| 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 11 matching lines...) Expand all Loading... | |
| 22 #include "chrome/browser/permissions/permission_request_manager.h" | 22 #include "chrome/browser/permissions/permission_request_manager.h" |
| 23 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
| 24 #include "chrome/browser/ui/browser_window.h" | 24 #include "chrome/browser/ui/browser_window.h" |
| 25 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" | 25 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" |
| 26 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 26 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 27 #include "chrome/common/chrome_features.h" | 27 #include "chrome/common/chrome_features.h" |
| 28 #include "chrome/test/base/in_process_browser_test.h" | 28 #include "chrome/test/base/in_process_browser_test.h" |
| 29 #include "chrome/test/base/interactive_test_utils.h" | 29 #include "chrome/test/base/interactive_test_utils.h" |
| 30 #include "chrome/test/base/ui_test_utils.h" | 30 #include "chrome/test/base/ui_test_utils.h" |
| 31 #include "content/public/browser/permission_type.h" | 31 #include "content/public/browser/permission_type.h" |
| 32 #include "content/public/common/content_features.h" | |
| 32 #include "content/public/common/content_switches.h" | 33 #include "content/public/common/content_switches.h" |
| 33 #include "content/public/test/browser_test_utils.h" | 34 #include "content/public/test/browser_test_utils.h" |
| 34 #include "net/base/filename_util.h" | 35 #include "net/base/filename_util.h" |
| 35 #include "net/test/embedded_test_server/embedded_test_server.h" | 36 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 36 #include "testing/gmock/include/gmock/gmock.h" | 37 #include "testing/gmock/include/gmock/gmock.h" |
| 37 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat us.mojom.h" | 38 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat us.mojom.h" |
| 38 | 39 |
| 39 #if BUILDFLAG(ENABLE_BACKGROUND) | 40 #if BUILDFLAG(ENABLE_BACKGROUND) |
| 40 #include "chrome/browser/lifetime/keep_alive_registry.h" | 41 #include "chrome/browser/lifetime/keep_alive_registry.h" |
| 41 #include "chrome/browser/lifetime/keep_alive_types.h" | 42 #include "chrome/browser/lifetime/keep_alive_types.h" |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 696 | 697 |
| 697 ASSERT_FALSE(browser()->window()->IsActive()); | 698 ASSERT_FALSE(browser()->window()->IsActive()); |
| 698 ASSERT_TRUE(other_browser->window()->IsActive()); | 699 ASSERT_TRUE(other_browser->window()->IsActive()); |
| 699 | 700 |
| 700 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); | 701 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); |
| 701 const Notification& notification = ui_manager()->GetNotificationAt(0); | 702 const Notification& notification = ui_manager()->GetNotificationAt(0); |
| 702 EXPECT_FALSE(notification.delegate()->ShouldDisplayOverFullscreen()); | 703 EXPECT_FALSE(notification.delegate()->ShouldDisplayOverFullscreen()); |
| 703 } | 704 } |
| 704 #endif | 705 #endif |
| 705 | 706 |
| 707 class PlatformNotificationServiceBrowserTestWithoutImages | |
|
Peter Beverloo
2016/11/15 19:39:20
"WithoutImages" implies a much broader scope than
johnme
2016/11/16 00:33:11
Done (ContentImage).
| |
| 708 : public PlatformNotificationServiceBrowserTest { | |
| 709 public: | |
| 710 // InProcessBrowserTest overrides. | |
| 711 void SetUpInProcessBrowserTestFixture() override { | |
| 712 scoped_feature_list_.InitAndDisableFeature(features::kNotificationImage); | |
| 713 InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); | |
| 714 } | |
| 715 | |
| 716 private: | |
| 717 base::test::ScopedFeatureList scoped_feature_list_; | |
| 718 }; | |
| 719 | |
| 720 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTestWithoutImages, | |
| 721 KillSwitch) { | |
| 722 ASSERT_NO_FATAL_FAILURE(GrantNotificationPermissionForTest()); | |
| 723 | |
| 724 std::string script_result; | |
| 725 ASSERT_TRUE( | |
| 726 RunScript("DisplayPersistentAllOptionsNotification()", &script_result)); | |
| 727 EXPECT_EQ("ok", script_result); | |
| 728 | |
| 729 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); | |
| 730 const Notification& notification = ui_manager()->GetNotificationAt(0); | |
| 731 | |
| 732 // Since the kNotificationImage kill switch has disabled images, the | |
| 733 // notification should be shown without an image. | |
| 734 EXPECT_TRUE(notification.image().IsEmpty()); | |
| 735 } | |
| OLD | NEW |