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

Unified Diff: chrome/browser/services/gcm/push_messaging_browsertest.cc

Issue 931113003: [Push] Use proper accessors for PushMessagingApplicationId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/services/gcm/push_messaging_browsertest.cc
diff --git a/chrome/browser/services/gcm/push_messaging_browsertest.cc b/chrome/browser/services/gcm/push_messaging_browsertest.cc
index 7dfd971e5793d99f34c0124561ef6dfe6087573f..d9432ab9549a85b902feb277697ab5a87e1a017b 100644
--- a/chrome/browser/services/gcm/push_messaging_browsertest.cc
+++ b/chrome/browser/services/gcm/push_messaging_browsertest.cc
@@ -295,7 +295,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
TryToRegisterSuccessfully("1-0" /* expected_push_registration_id */);
PushMessagingApplicationId app_id = GetServiceWorkerAppId(0LL);
- EXPECT_EQ(app_id.app_id_guid, gcm_service()->last_registered_app_id());
+ EXPECT_EQ(app_id.app_id_guid(), gcm_service()->last_registered_app_id());
EXPECT_EQ("1234567890", gcm_service()->last_registered_sender_ids()[0]);
}
@@ -311,7 +311,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
EXPECT_EQ(std::string(kPushMessagingEndpoint) + " - 1-0", script_result);
PushMessagingApplicationId app_id = GetServiceWorkerAppId(0LL);
- EXPECT_EQ(app_id.app_id_guid, gcm_service()->last_registered_app_id());
+ EXPECT_EQ(app_id.app_id_guid(), gcm_service()->last_registered_app_id());
EXPECT_EQ("1234567890", gcm_service()->last_registered_sender_ids()[0]);
}
@@ -361,7 +361,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, RegisterPersisted) {
TryToRegisterSuccessfully("1-0" /* expected_push_registration_id */);
PushMessagingApplicationId app_id_sw0 = GetServiceWorkerAppId(0LL);
- EXPECT_EQ(app_id_sw0.app_id_guid, gcm_service()->last_registered_app_id());
+ EXPECT_EQ(app_id_sw0.app_id_guid(), gcm_service()->last_registered_app_id());
LoadTestPage("files/push_messaging/subscope1/test.html");
ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result));
@@ -377,12 +377,12 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, RegisterPersisted) {
LoadTestPage("files/push_messaging/subscope2/test.html");
TryToRegisterSuccessfully("1-1" /* expected_push_registration_id */);
PushMessagingApplicationId app_id_sw2 = GetServiceWorkerAppId(2LL);
- EXPECT_EQ(app_id_sw2.app_id_guid, gcm_service()->last_registered_app_id());
+ EXPECT_EQ(app_id_sw2.app_id_guid(), gcm_service()->last_registered_app_id());
LoadTestPage("files/push_messaging/subscope1/test.html");
TryToRegisterSuccessfully("1-2" /* expected_push_registration_id */);
PushMessagingApplicationId app_id_sw1 = GetServiceWorkerAppId(1LL);
- EXPECT_EQ(app_id_sw1.app_id_guid, gcm_service()->last_registered_app_id());
+ EXPECT_EQ(app_id_sw1.app_id_guid(), gcm_service()->last_registered_app_id());
// Now test that the Service Worker registration IDs and push registration IDs
// generated above were persisted to SW storage, by checking that they are
@@ -394,15 +394,15 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, RegisterPersisted) {
LoadTestPage("files/push_messaging/subscope1/test.html");
TryToRegisterSuccessfully("1-2" /* expected_push_registration_id */);
- EXPECT_EQ(app_id_sw1.app_id_guid, gcm_service()->last_registered_app_id());
+ EXPECT_EQ(app_id_sw1.app_id_guid(), gcm_service()->last_registered_app_id());
LoadTestPage("files/push_messaging/subscope2/test.html");
TryToRegisterSuccessfully("1-1" /* expected_push_registration_id */);
- EXPECT_EQ(app_id_sw1.app_id_guid, gcm_service()->last_registered_app_id());
+ EXPECT_EQ(app_id_sw1.app_id_guid(), gcm_service()->last_registered_app_id());
LoadTestPage();
TryToRegisterSuccessfully("1-0" /* expected_push_registration_id */);
- EXPECT_EQ(app_id_sw1.app_id_guid, gcm_service()->last_registered_app_id());
+ EXPECT_EQ(app_id_sw1.app_id_guid(), gcm_service()->last_registered_app_id());
}
IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PushEventSuccess) {
@@ -411,7 +411,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PushEventSuccess) {
TryToRegisterSuccessfully("1-0" /* expected_push_registration_id */);
PushMessagingApplicationId app_id = GetServiceWorkerAppId(0LL);
- EXPECT_EQ(app_id.app_id_guid, gcm_service()->last_registered_app_id());
+ EXPECT_EQ(app_id.app_id_guid(), gcm_service()->last_registered_app_id());
EXPECT_EQ("1234567890", gcm_service()->last_registered_sender_ids()[0]);
ASSERT_TRUE(RunScript("isControlled()", &script_result));
@@ -424,7 +424,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PushEventSuccess) {
GCMClient::IncomingMessage message;
message.data["data"] = "testdata";
- push_service()->OnMessage(app_id.app_id_guid, message);
+ push_service()->OnMessage(app_id.app_id_guid(), message);
ASSERT_TRUE(RunScript("resultQueue.pop()", &script_result));
EXPECT_EQ("testdata", script_result);
}
@@ -435,7 +435,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PushEventNoServiceWorker) {
TryToRegisterSuccessfully("1-0" /* expected_push_registration_id */);
PushMessagingApplicationId app_id = GetServiceWorkerAppId(0LL);
- EXPECT_EQ(app_id.app_id_guid, gcm_service()->last_registered_app_id());
+ EXPECT_EQ(app_id.app_id_guid(), gcm_service()->last_registered_app_id());
EXPECT_EQ("1234567890", gcm_service()->last_registered_sender_ids()[0]);
ASSERT_TRUE(RunScript("isControlled()", &script_result));
@@ -458,10 +458,10 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PushEventNoServiceWorker) {
GCMClient::IncomingMessage message;
message.data["data"] = "testdata";
- push_service()->OnMessage(app_id.app_id_guid, message);
+ push_service()->OnMessage(app_id.app_id_guid(), message);
callback.WaitUntilSatisfied();
- EXPECT_EQ(app_id.app_id_guid, callback.app_id());
+ EXPECT_EQ(app_id.app_id_guid(), callback.app_id());
// No push data should have been received.
ASSERT_TRUE(RunScript("resultQueue.popImmediately()", &script_result));
@@ -474,7 +474,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PushEventNoPermission) {
TryToRegisterSuccessfully("1-0" /* expected_push_registration_id */);
PushMessagingApplicationId app_id = GetServiceWorkerAppId(0LL);
- EXPECT_EQ(app_id.app_id_guid, gcm_service()->last_registered_app_id());
+ EXPECT_EQ(app_id.app_id_guid(), gcm_service()->last_registered_app_id());
EXPECT_EQ("1234567890", gcm_service()->last_registered_sender_ids()[0]);
ASSERT_TRUE(RunScript("isControlled()", &script_result));
@@ -497,10 +497,10 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PushEventNoPermission) {
GCMClient::IncomingMessage message;
message.data["data"] = "testdata";
- push_service()->OnMessage(app_id.app_id_guid, message);
+ push_service()->OnMessage(app_id.app_id_guid(), message);
callback.WaitUntilSatisfied();
- EXPECT_EQ(app_id.app_id_guid, callback.app_id());
+ EXPECT_EQ(app_id.app_id_guid(), callback.app_id());
// No push data should have been received.
ASSERT_TRUE(RunScript("resultQueue.popImmediately()", &script_result));
@@ -515,7 +515,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
TryToRegisterSuccessfully("1-0" /* expected_push_registration_id */);
PushMessagingApplicationId app_id = GetServiceWorkerAppId(0LL);
- EXPECT_EQ(app_id.app_id_guid, gcm_service()->last_registered_app_id());
+ EXPECT_EQ(app_id.app_id_guid(), gcm_service()->last_registered_app_id());
EXPECT_EQ("1234567890", gcm_service()->last_registered_sender_ids()[0]);
ASSERT_TRUE(RunScript("isControlled()", &script_result));
@@ -539,7 +539,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
GCMClient::IncomingMessage message;
for (int n = 0; n < 2; n++) {
message.data["data"] = "testdata";
- push_service()->OnMessage(app_id.app_id_guid, message);
+ push_service()->OnMessage(app_id.app_id_guid(), message);
ASSERT_TRUE(RunScript("resultQueue.pop()", &script_result));
EXPECT_EQ("testdata", script_result);
EXPECT_EQ(0u, notification_manager()->GetNotificationCount());
@@ -554,12 +554,12 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
// should show a forced one, but only on the 2nd occurrence since we allow one
// mistake per 10 push events.
message.data["data"] = "testdata";
- push_service()->OnMessage(app_id.app_id_guid, message);
+ push_service()->OnMessage(app_id.app_id_guid(), message);
ASSERT_TRUE(RunScript("resultQueue.pop()", &script_result, web_contents));
EXPECT_EQ("testdata", script_result);
EXPECT_EQ(0u, notification_manager()->GetNotificationCount());
message.data["data"] = "testdata";
- push_service()->OnMessage(app_id.app_id_guid, message);
+ push_service()->OnMessage(app_id.app_id_guid(), message);
ASSERT_TRUE(RunScript("resultQueue.pop()", &script_result, web_contents));
EXPECT_EQ("testdata", script_result);
EXPECT_EQ(1u, notification_manager()->GetNotificationCount());
@@ -569,7 +569,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
// Currently, this notification will stick around until the user or webapp
// explicitly dismisses it (though we may change this later).
message.data["data"] = "shownotification";
- push_service()->OnMessage(app_id.app_id_guid, message);
+ push_service()->OnMessage(app_id.app_id_guid(), message);
ASSERT_TRUE(RunScript("resultQueue.pop()", &script_result, web_contents));
EXPECT_EQ("shownotification", script_result);
EXPECT_EQ(2u, notification_manager()->GetNotificationCount());
@@ -581,7 +581,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
// should not show a forced one.
message.data["data"] = "shownotification";
for (int n = 0; n < 9; n++) {
- push_service()->OnMessage(app_id.app_id_guid, message);
+ push_service()->OnMessage(app_id.app_id_guid(), message);
ASSERT_TRUE(RunScript("resultQueue.pop()", &script_result, web_contents));
EXPECT_EQ("shownotification", script_result);
EXPECT_EQ(1u, notification_manager()->GetNotificationCount());
@@ -593,7 +593,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
// Now that 10 push messages in a row have shown notifications, we should
// allow the next one to mistakenly not show a notification.
message.data["data"] = "testdata";
- push_service()->OnMessage(app_id.app_id_guid, message);
+ push_service()->OnMessage(app_id.app_id_guid(), message);
ASSERT_TRUE(RunScript("resultQueue.pop()", &script_result, web_contents));
EXPECT_EQ("testdata", script_result);
EXPECT_EQ(0u, notification_manager()->GetNotificationCount());
@@ -608,7 +608,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
TryToRegisterSuccessfully("1-0" /* expected_push_registration_id */);
PushMessagingApplicationId app_id = GetServiceWorkerAppId(0LL);
- EXPECT_EQ(app_id.app_id_guid, gcm_service()->last_registered_app_id());
+ EXPECT_EQ(app_id.app_id_guid(), gcm_service()->last_registered_app_id());
EXPECT_EQ("1234567890", gcm_service()->last_registered_sender_ids()[0]);
ASSERT_TRUE(RunScript("isControlled()", &script_result));
@@ -625,7 +625,7 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
GCMClient::IncomingMessage message;
message.data["data"] = "shownotification-without-waituntil";
- push_service()->OnMessage(app_id.app_id_guid, message);
+ push_service()->OnMessage(app_id.app_id_guid(), message);
ASSERT_TRUE(RunScript("resultQueue.pop()", &script_result, web_contents));
EXPECT_EQ("immediate:shownotification-without-waituntil", script_result);

Powered by Google App Engine
This is Rietveld 408576698