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

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

Issue 2507463003: Add kill switch for Notification images (Closed)
Patch Set: Rename test subclass Created 4 years, 1 month 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
« no previous file with comments | « no previous file | content/browser/notifications/notification_message_filter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 11 matching lines...) Expand all
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
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 PlatformNotificationServiceWithoutContentImageBrowserTest
708 : public PlatformNotificationServiceBrowserTest {
709 public:
710 // InProcessBrowserTest overrides.
711 void SetUpInProcessBrowserTestFixture() override {
712 scoped_feature_list_.InitAndDisableFeature(
713 features::kNotificationContentImage);
714 InProcessBrowserTest::SetUpInProcessBrowserTestFixture();
715 }
716
717 private:
718 base::test::ScopedFeatureList scoped_feature_list_;
719 };
720
721 IN_PROC_BROWSER_TEST_F(
722 PlatformNotificationServiceWithoutContentImageBrowserTest,
723 KillSwitch) {
724 ASSERT_NO_FATAL_FAILURE(GrantNotificationPermissionForTest());
725
726 std::string script_result;
727 ASSERT_TRUE(
728 RunScript("DisplayPersistentAllOptionsNotification()", &script_result));
729 EXPECT_EQ("ok", script_result);
730
731 ASSERT_EQ(1u, ui_manager()->GetNotificationCount());
732 const Notification& notification = ui_manager()->GetNotificationAt(0);
733
734 // Since the kNotificationContentImage kill switch has disabled images, the
735 // notification should be shown without an image.
736 EXPECT_TRUE(notification.image().IsEmpty());
737 }
OLDNEW
« no previous file with comments | « no previous file | content/browser/notifications/notification_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698