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

Side by Side Diff: chrome/browser/push_messaging/push_messaging_browsertest.cc

Issue 1099673002: Prepare Push Messaging browser tests for the endpoint value change. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 7 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
« no previous file with comments | « no previous file | no next file » | 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 <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 7
8 #include "base/barrier_closure.h" 8 #include "base/barrier_closure.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 std::string script_result; 216 std::string script_result;
217 217
218 EXPECT_TRUE(RunScript("registerServiceWorker()", &script_result)); 218 EXPECT_TRUE(RunScript("registerServiceWorker()", &script_result));
219 EXPECT_EQ("ok - service worker registered", script_result); 219 EXPECT_EQ("ok - service worker registered", script_result);
220 220
221 InfoBarResponder accepting_responder(GetInfoBarService(), true); 221 InfoBarResponder accepting_responder(GetInfoBarService(), true);
222 EXPECT_TRUE(RunScript("requestNotificationPermission()", &script_result)); 222 EXPECT_TRUE(RunScript("requestNotificationPermission()", &script_result));
223 EXPECT_EQ("permission status - granted", script_result); 223 EXPECT_EQ("permission status - granted", script_result);
224 224
225 EXPECT_TRUE(RunScript("subscribePush()", &script_result)); 225 EXPECT_TRUE(RunScript("subscribePush()", &script_result));
226 EXPECT_EQ(std::string(kPushMessagingEndpoint) + " - " 226
227 + expected_push_subscription_id, script_result); 227 // TODO(peter): Add an EXPECT for the given endpoint after the value change
228 // has gone through.
228 } 229 }
229 230
230 PushMessagingApplicationId PushMessagingBrowserTest::GetServiceWorkerAppId( 231 PushMessagingApplicationId PushMessagingBrowserTest::GetServiceWorkerAppId(
231 int64 service_worker_registration_id) { 232 int64 service_worker_registration_id) {
232 GURL origin = https_server()->GetURL(std::string()).GetOrigin(); 233 GURL origin = https_server()->GetURL(std::string()).GetOrigin();
233 PushMessagingApplicationId application_id = PushMessagingApplicationId::Get( 234 PushMessagingApplicationId application_id = PushMessagingApplicationId::Get(
234 GetBrowser()->profile(), origin, service_worker_registration_id); 235 GetBrowser()->profile(), origin, service_worker_registration_id);
235 EXPECT_TRUE(application_id.IsValid()); 236 EXPECT_TRUE(application_id.IsValid());
236 return application_id; 237 return application_id;
237 } 238 }
(...skipping 18 matching lines...) Expand all
256 257
257 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, 258 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
258 SubscribeSuccessNotificationsPrompt) { 259 SubscribeSuccessNotificationsPrompt) {
259 std::string script_result; 260 std::string script_result;
260 261
261 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); 262 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result));
262 ASSERT_EQ("ok - service worker registered", script_result); 263 ASSERT_EQ("ok - service worker registered", script_result);
263 264
264 InfoBarResponder accepting_responder(GetInfoBarService(), true); 265 InfoBarResponder accepting_responder(GetInfoBarService(), true);
265 ASSERT_TRUE(RunScript("subscribePush()", &script_result)); 266 ASSERT_TRUE(RunScript("subscribePush()", &script_result));
266 EXPECT_EQ(std::string(kPushMessagingEndpoint) + " - 1-0", script_result); 267
268 // TODO(peter): Add an EXPECT for the given endpoint after the value change
269 // has gone through.
267 270
268 PushMessagingApplicationId app_id = GetServiceWorkerAppId(0LL); 271 PushMessagingApplicationId app_id = GetServiceWorkerAppId(0LL);
269 EXPECT_EQ(app_id.app_id_guid(), gcm_service()->last_registered_app_id()); 272 EXPECT_EQ(app_id.app_id_guid(), gcm_service()->last_registered_app_id());
270 EXPECT_EQ("1234567890", gcm_service()->last_registered_sender_ids()[0]); 273 EXPECT_EQ("1234567890", gcm_service()->last_registered_sender_ids()[0]);
271 } 274 }
272 275
273 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, 276 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
274 SubscribeFailureNotificationsBlocked) { 277 SubscribeFailureNotificationsBlocked) {
275 std::string script_result; 278 std::string script_result;
276 279
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 std::string script_result; 583 std::string script_result;
581 584
582 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); 585 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result));
583 ASSERT_EQ("ok - service worker registered", script_result); 586 ASSERT_EQ("ok - service worker registered", script_result);
584 587
585 InfoBarResponder accepting_responder(GetInfoBarService(), true); 588 InfoBarResponder accepting_responder(GetInfoBarService(), true);
586 ASSERT_TRUE(RunScript("requestNotificationPermission();", &script_result)); 589 ASSERT_TRUE(RunScript("requestNotificationPermission();", &script_result));
587 EXPECT_EQ("permission status - granted", script_result); 590 EXPECT_EQ("permission status - granted", script_result);
588 591
589 ASSERT_TRUE(RunScript("subscribePush()", &script_result)); 592 ASSERT_TRUE(RunScript("subscribePush()", &script_result));
590 EXPECT_EQ(std::string(kPushMessagingEndpoint) + " - 1-0", script_result); 593
594 // TODO(peter): Add an EXPECT for the given endpoint after the value change
595 // has gone through.
591 596
592 ASSERT_TRUE(RunScript("permissionState()", &script_result)); 597 ASSERT_TRUE(RunScript("permissionState()", &script_result));
593 EXPECT_EQ("permission status - granted", script_result); 598 EXPECT_EQ("permission status - granted", script_result);
594 } 599 }
595 600
596 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PermissionStateSaysDenied) { 601 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PermissionStateSaysDenied) {
597 std::string script_result; 602 std::string script_result;
598 603
599 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); 604 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result));
600 ASSERT_EQ("ok - service worker registered", script_result); 605 ASSERT_EQ("ok - service worker registered", script_result);
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 std::string script_result; 1018 std::string script_result;
1014 1019
1015 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); 1020 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result));
1016 ASSERT_EQ("ok - service worker registered", script_result); 1021 ASSERT_EQ("ok - service worker registered", script_result);
1017 1022
1018 // In Incognito mode the promise returned by getSubscription should not hang, 1023 // In Incognito mode the promise returned by getSubscription should not hang,
1019 // it should just fulfill with null. 1024 // it should just fulfill with null.
1020 ASSERT_TRUE(RunScript("hasSubscription()", &script_result)); 1025 ASSERT_TRUE(RunScript("hasSubscription()", &script_result));
1021 ASSERT_EQ("false - not subscribed", script_result); 1026 ASSERT_EQ("false - not subscribed", script_result);
1022 } 1027 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698