summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfelt <felt@chromium.org>2015-06-26 12:05:12 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-26 19:06:50 +0000
commit5977b7ae2cc864964f314de71bdc5f0058aa862d (patch)
treeafe94294066a6ce9a9770a78656e5144d48614db
parent68d3feb36f12c29f485af509c2543b27f564ef1f (diff)
downloadchromium_src-5977b7ae2cc864964f314de71bdc5f0058aa862d.zip
chromium_src-5977b7ae2cc864964f314de71bdc5f0058aa862d.tar.gz
chromium_src-5977b7ae2cc864964f314de71bdc5f0058aa862d.tar.bz2
Remove infobars from the push messaging browsertest
Now that bubbles are the permanent permission request UI for desktop, the tests no longer need to test infobars. This removes the infobar test code from the push messsaging browser tests. BUG=502515 Review URL: https://codereview.chromium.org/1221463002 Cr-Commit-Position: refs/heads/master@{#336434}
-rw-r--r--chrome/browser/push_messaging/push_messaging_browsertest.cc114
1 files changed, 35 insertions, 79 deletions
diff --git a/chrome/browser/push_messaging/push_messaging_browsertest.cc b/chrome/browser/push_messaging/push_messaging_browsertest.cc
index 0cd1a74..8f3cc8d 100644
--- a/chrome/browser/push_messaging/push_messaging_browsertest.cc
+++ b/chrome/browser/push_messaging/push_messaging_browsertest.cc
@@ -14,8 +14,6 @@
#include "chrome/browser/browsing_data/browsing_data_helper.h"
#include "chrome/browser/browsing_data/browsing_data_remover.h"
#include "chrome/browser/browsing_data/browsing_data_remover_test_util.h"
-#include "chrome/browser/infobars/infobar_responder.h"
-#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/notifications/notification_test_util.h"
#include "chrome/browser/notifications/platform_notification_service_impl.h"
#include "chrome/browser/profiles/profile.h"
@@ -71,8 +69,7 @@ class UnregistrationCallback {
} // namespace
-class PushMessagingBrowserTest : public InProcessBrowserTest,
- public testing::WithParamInterface<bool> {
+class PushMessagingBrowserTest : public InProcessBrowserTest {
public:
PushMessagingBrowserTest() : gcm_service_(nullptr) {}
~PushMessagingBrowserTest() override {}
@@ -80,15 +77,6 @@ class PushMessagingBrowserTest : public InProcessBrowserTest,
// InProcessBrowserTest:
void SetUpCommandLine(base::CommandLine* command_line) override {
command_line->AppendSwitch(switches::kEnablePushMessagePayload);
-
- if (GetParam()) {
- command_line->AppendSwitch(switches::kEnablePermissionsBubbles);
- EXPECT_TRUE(PermissionBubbleManager::Enabled());
- } else {
- command_line->AppendSwitch(switches::kDisablePermissionsBubbles);
- EXPECT_FALSE(PermissionBubbleManager::Enabled());
- }
-
InProcessBrowserTest::SetUpCommandLine(command_line);
}
@@ -211,11 +199,6 @@ class PushMessagingBrowserTest : public InProcessBrowserTest,
virtual Browser* GetBrowser() const { return browser(); }
- InfoBarService* GetInfoBarService() {
- return InfoBarService::FromWebContents(
- GetBrowser()->tab_strip_model()->GetActiveWebContents());
- }
-
private:
scoped_ptr<net::SpawnedTestServer> https_server_;
gcm::FakeGCMProfileService* gcm_service_;
@@ -237,31 +220,17 @@ class PushMessagingBrowserTestEmptySubscriptionOptions
void PushMessagingBrowserTest::RequestAndAcceptPermission() {
std::string script_result;
-
- if (PermissionBubbleManager::Enabled()) {
- GetPermissionBubbleManager()->set_auto_response_for_test(
- PermissionBubbleManager::ACCEPT_ALL);
- EXPECT_TRUE(RunScript("requestNotificationPermission();", &script_result));
- } else {
- InfoBarResponder infobar_accept_responder(GetInfoBarService(),
- InfoBarResponder::ACCEPT);
- EXPECT_TRUE(RunScript("requestNotificationPermission();", &script_result));
- }
+ GetPermissionBubbleManager()->set_auto_response_for_test(
+ PermissionBubbleManager::ACCEPT_ALL);
+ EXPECT_TRUE(RunScript("requestNotificationPermission();", &script_result));
EXPECT_EQ("permission status - granted", script_result);
}
void PushMessagingBrowserTest::RequestAndDenyPermission() {
std::string script_result;
-
- if (PermissionBubbleManager::Enabled()) {
- GetPermissionBubbleManager()->set_auto_response_for_test(
- PermissionBubbleManager::DENY_ALL);
- EXPECT_TRUE(RunScript("requestNotificationPermission();", &script_result));
- } else {
- InfoBarResponder infobar_deny_responder(GetInfoBarService(),
- InfoBarResponder::DENY);
- EXPECT_TRUE(RunScript("requestNotificationPermission();", &script_result));
- }
+ GetPermissionBubbleManager()->set_auto_response_for_test(
+ PermissionBubbleManager::DENY_ALL);
+ EXPECT_TRUE(RunScript("requestNotificationPermission();", &script_result));
EXPECT_EQ("permission status - denied", script_result);
}
@@ -299,7 +268,7 @@ void PushMessagingBrowserTest::SendMessageAndWaitUntilHandled(
run_loop.Run();
}
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
SubscribeSuccessNotificationsGranted) {
TryToSubscribeSuccessfully("1-0" /* expected_push_subscription_id */);
@@ -309,22 +278,16 @@ IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
EXPECT_EQ("1234567890", gcm_service()->last_registered_sender_ids()[0]);
}
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
SubscribeSuccessNotificationsPrompt) {
std::string script_result;
ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result));
ASSERT_EQ("ok - service worker registered", script_result);
- if (PermissionBubbleManager::Enabled()) {
- GetPermissionBubbleManager()->set_auto_response_for_test(
- PermissionBubbleManager::ACCEPT_ALL);
- ASSERT_TRUE(RunScript("subscribePush()", &script_result));
- } else {
- InfoBarResponder infobar_accept_responder(GetInfoBarService(),
- InfoBarResponder::ACCEPT);
- ASSERT_TRUE(RunScript("subscribePush()", &script_result));
- }
+ GetPermissionBubbleManager()->set_auto_response_for_test(
+ PermissionBubbleManager::ACCEPT_ALL);
+ ASSERT_TRUE(RunScript("subscribePush()", &script_result));
EXPECT_EQ(GetEndpointForSubscriptionId("1-0"), script_result);
PushMessagingAppIdentifier app_identifier =
@@ -333,7 +296,7 @@ IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
EXPECT_EQ("1234567890", gcm_service()->last_registered_sender_ids()[0]);
}
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
SubscribeFailureNotificationsBlocked) {
std::string script_result;
@@ -347,7 +310,7 @@ IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
script_result);
}
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest, SubscribeFailureNoManifest) {
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, SubscribeFailureNoManifest) {
std::string script_result;
ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result));
@@ -365,7 +328,7 @@ IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest, SubscribeFailureNoManifest) {
// TODO(johnme): Test subscribing from a worker - see https://crbug.com/437298.
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTestEmptySubscriptionOptions,
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTestEmptySubscriptionOptions,
RegisterFailureEmptyPushSubscriptionOptions) {
std::string script_result;
@@ -379,7 +342,7 @@ IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTestEmptySubscriptionOptions,
script_result);
}
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest, SubscribePersisted) {
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, SubscribePersisted) {
std::string script_result;
// First, test that Service Worker registration IDs are assigned in order of
@@ -436,7 +399,7 @@ IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest, SubscribePersisted) {
EXPECT_EQ(sw1_identifier.app_id(), gcm_service()->last_registered_app_id());
}
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest, PushEventSuccess) {
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PushEventSuccess) {
std::string script_result;
TryToSubscribeSuccessfully("1-0" /* expected_push_subscription_id */);
@@ -462,7 +425,7 @@ IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest, PushEventSuccess) {
EXPECT_EQ("testdata", script_result);
}
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest, PushEventNoServiceWorker) {
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PushEventNoServiceWorker) {
std::string script_result;
TryToSubscribeSuccessfully("1-0" /* expected_push_subscription_id */);
@@ -504,7 +467,7 @@ IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest, PushEventNoServiceWorker) {
}
#if defined(ENABLE_NOTIFICATIONS)
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
PushEventEnforcesUserVisibleNotification) {
std::string script_result;
@@ -610,7 +573,7 @@ IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
EXPECT_EQ(0u, notification_manager()->GetNotificationCount());
}
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
PushEventEnforcesUserVisibleNotificationAfterQueue) {
std::string script_result;
@@ -662,7 +625,7 @@ IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
EXPECT_EQ(1u, number_of_notifications_shown[1]);
}
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
PushEventNotificationWithoutEventWaitUntil) {
std::string script_result;
content::WebContents* web_contents =
@@ -707,7 +670,7 @@ IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
}
#endif
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest, PermissionStateSaysPrompt) {
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PermissionStateSaysPrompt) {
std::string script_result;
ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result));
@@ -717,7 +680,7 @@ IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest, PermissionStateSaysPrompt) {
ASSERT_EQ("permission status - prompt", script_result);
}
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest, PermissionStateSaysGranted) {
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PermissionStateSaysGranted) {
std::string script_result;
ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result));
@@ -733,7 +696,7 @@ IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest, PermissionStateSaysGranted) {
EXPECT_EQ("permission status - granted", script_result);
}
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest, PermissionStateSaysDenied) {
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PermissionStateSaysDenied) {
std::string script_result;
ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result));
@@ -749,7 +712,7 @@ IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest, PermissionStateSaysDenied) {
EXPECT_EQ("permission status - denied", script_result);
}
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest, UnsubscribeSuccess) {
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, UnsubscribeSuccess) {
std::string script_result;
EXPECT_TRUE(RunScript("registerServiceWorker()", &script_result));
@@ -791,7 +754,7 @@ IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest, UnsubscribeSuccess) {
EXPECT_EQ("unsubscribe result: false", script_result);
}
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
GlobalResetPushPermissionUnsubscribes) {
std::string script_result;
@@ -820,7 +783,7 @@ IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
EXPECT_EQ("false - not subscribed", script_result);
}
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
LocalResetPushPermissionUnsubscribes) {
std::string script_result;
@@ -854,7 +817,7 @@ IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
EXPECT_EQ("false - not subscribed", script_result);
}
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
DenyPushPermissionUnsubscribes) {
std::string script_result;
@@ -888,7 +851,7 @@ IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
EXPECT_EQ("false - not subscribed", script_result);
}
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
GlobalResetNotificationsPermissionUnsubscribes) {
std::string script_result;
@@ -917,7 +880,7 @@ IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
EXPECT_EQ("false - not subscribed", script_result);
}
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
LocalResetNotificationsPermissionUnsubscribes) {
std::string script_result;
@@ -951,7 +914,7 @@ IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
EXPECT_EQ("false - not subscribed", script_result);
}
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
DenyNotificationsPermissionUnsubscribes) {
std::string script_result;
@@ -985,7 +948,7 @@ IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
EXPECT_EQ("false - not subscribed", script_result);
}
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
GrantAlreadyGrantedPermissionDoesNotUnsubscribe) {
std::string script_result;
@@ -1029,7 +992,7 @@ IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
// that they are respected with regards to automatic unsubscription. In other
// words, it checks that the push service does not end up unsubscribing origins
// that have push permission with some non-common rules.
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
AutomaticUnsubscriptionFollowsContentSettingRules) {
std::string script_result;
@@ -1088,7 +1051,7 @@ IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
// Checks that automatically unsubscribing due to a revoked permission is
// handled well if the sender ID needed to unsubscribe was already deleted.
-IN_PROC_BROWSER_TEST_P(PushMessagingBrowserTest,
+IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
ResetPushPermissionAfterClearingSiteData) {
std::string script_result;
@@ -1147,7 +1110,7 @@ class PushMessagingIncognitoBrowserTest : public PushMessagingBrowserTest {
};
// Regression test for https://crbug.com/476474
-IN_PROC_BROWSER_TEST_P(PushMessagingIncognitoBrowserTest,
+IN_PROC_BROWSER_TEST_F(PushMessagingIncognitoBrowserTest,
IncognitoGetSubscriptionDoesNotHang) {
ASSERT_TRUE(GetBrowser()->profile()->IsOffTheRecord());
@@ -1161,10 +1124,3 @@ IN_PROC_BROWSER_TEST_P(PushMessagingIncognitoBrowserTest,
ASSERT_TRUE(RunScript("hasSubscription()", &script_result));
ASSERT_EQ("false - not subscribed", script_result);
}
-
-INSTANTIATE_TEST_CASE_P(PushMessagingBrowserTestWithParams,
- PushMessagingBrowserTest,
- testing::Values(true, false));
-INSTANTIATE_TEST_CASE_P(PushMessagingIncognitoBrowserTestWithParams,
- PushMessagingIncognitoBrowserTest,
- testing::Values(true, false));