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

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

Issue 2910843002: [Cleanup] Move all browsertests to use ScopedFeatureList to modify features
Patch Set: comments addressed and updated Created 3 years, 5 months 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
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/feature_list.h" 10 #include "base/feature_list.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // The test server has a base directory that doesn't exist in the 137 // The test server has a base directory that doesn't exist in the
138 // filesystem. 138 // filesystem.
139 test_page_url_(std::string("/") + kTestFileName) {} 139 test_page_url_(std::string("/") + kTestFileName) {}
140 140
141 void PlatformNotificationServiceBrowserTest::SetUpDefaultCommandLine( 141 void PlatformNotificationServiceBrowserTest::SetUpDefaultCommandLine(
142 base::CommandLine* command_line) { 142 base::CommandLine* command_line) {
143 InProcessBrowserTest::SetUpDefaultCommandLine(command_line); 143 InProcessBrowserTest::SetUpDefaultCommandLine(command_line);
144 144
145 // Needed for the Reply button tests 145 // Needed for the Reply button tests
146 command_line->AppendSwitch(switches::kEnableExperimentalWebPlatformFeatures); 146 command_line->AppendSwitch(switches::kEnableExperimentalWebPlatformFeatures);
147
148 #if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
149 // TODO(crbug.com/714679): Temporary change while tests are upgraded to deal
150 // with native notifications.
151 command_line->AppendSwitchASCII(switches::kDisableFeatures,
152 features::kNativeNotifications.name);
153 #endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
154 } 147 }
155 148
156 void PlatformNotificationServiceBrowserTest::SetUp() { 149 void PlatformNotificationServiceBrowserTest::SetUp() {
157 ui_manager_.reset(new StubNotificationUIManager); 150 ui_manager_.reset(new StubNotificationUIManager);
158 https_server_.reset( 151 https_server_.reset(
159 new net::EmbeddedTestServer(net::EmbeddedTestServer::TYPE_HTTPS)); 152 new net::EmbeddedTestServer(net::EmbeddedTestServer::TYPE_HTTPS));
160 https_server_->ServeFilesFromSourceDirectory(server_root_); 153 https_server_->ServeFilesFromSourceDirectory(server_root_);
161 ASSERT_TRUE(https_server_->Start()); 154 ASSERT_TRUE(https_server_->Start());
155 #if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
156 // TODO(crbug.com/714679): Temporary change while tests are upgraded to deal
157 // with native notifications.
158 feature_list_.InitAndDisableFeature(features::kNativeNotifications);
159 #endif // BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
162 InProcessBrowserTest::SetUp(); 160 InProcessBrowserTest::SetUp();
163 } 161 }
164 162
165 void PlatformNotificationServiceBrowserTest::SetUpOnMainThread() { 163 void PlatformNotificationServiceBrowserTest::SetUpOnMainThread() {
166 SiteEngagementScore::SetParamValuesForTesting(); 164 SiteEngagementScore::SetParamValuesForTesting();
167 engagement_service_ = SiteEngagementService::Get(browser()->profile()); 165 engagement_service_ = SiteEngagementService::Get(browser()->profile());
168 NavigateToTestPage(test_page_url_); 166 NavigateToTestPage(test_page_url_);
169 display_service_.reset( 167 display_service_.reset(
170 new MessageCenterDisplayService(browser()->profile(), ui_manager_.get())); 168 new MessageCenterDisplayService(browser()->profile(), ui_manager_.get()));
171 service()->SetNotificationDisplayServiceForTesting(display_service_.get()); 169 service()->SetNotificationDisplayServiceForTesting(display_service_.get());
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 RunScript("DisplayPersistentAllOptionsNotification()", &script_result)); 852 RunScript("DisplayPersistentAllOptionsNotification()", &script_result));
855 EXPECT_EQ("ok", script_result); 853 EXPECT_EQ("ok", script_result);
856 854
857 ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); 855 ASSERT_EQ(1u, ui_manager()->GetNotificationCount());
858 const Notification& notification = ui_manager()->GetNotificationAt(0); 856 const Notification& notification = ui_manager()->GetNotificationAt(0);
859 857
860 // Since the kNotificationContentImage kill switch has disabled images, the 858 // Since the kNotificationContentImage kill switch has disabled images, the
861 // notification should be shown without an image. 859 // notification should be shown without an image.
862 EXPECT_TRUE(notification.image().IsEmpty()); 860 EXPECT_TRUE(notification.image().IsEmpty());
863 } 861 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698