Commit 0dfb6cdf authored by fgorski's avatar fgorski Committed by Commit bot

Setting max TTL for upstream GCM messages to 1 day to match server side

Updating relevant tests.

BUG=413801
R=jianli@chromium.org,zea@chromium.org,scheib@chromium.org

Review URL: https://codereview.chromium.org/589663004

Cr-Commit-Position: refs/heads/master@{#296083}
parent 2faeee15
...@@ -171,7 +171,7 @@ IN_PROC_BROWSER_TEST_F(GcmApiTest, SendMessageDefaultTTL) { ...@@ -171,7 +171,7 @@ IN_PROC_BROWSER_TEST_F(GcmApiTest, SendMessageDefaultTTL) {
service()->last_sent_message(); service()->last_sent_message();
gcm::GCMClient::MessageData::const_iterator iter; gcm::GCMClient::MessageData::const_iterator iter;
EXPECT_EQ(2419200, message.time_to_live); EXPECT_EQ(gcm::GCMClient::OutgoingMessage::kMaximumTTL, message.time_to_live);
} }
IN_PROC_BROWSER_TEST_F(GcmApiTest, OnMessagesDeleted) { IN_PROC_BROWSER_TEST_F(GcmApiTest, OnMessagesDeleted) {
......
...@@ -79,9 +79,9 @@ ...@@ -79,9 +79,9 @@
"timeToLive": { "timeToLive": {
"type": "integer", "type": "integer",
"minimum": 0, "minimum": 0,
"maximum": 2419200, "maximum": 86400,
"optional": true, "optional": true,
"description": "Time-to-live of the message in seconds. If it is not possible to send the message within that time, an onSendError event will be raised. A time-to-live of 0 indicates that the message should be sent immediately or fail if it's not possible. The maximum and a default value of time-to-live is 2419200 seconds (4 weeks)." "description": "Time-to-live of the message in seconds. If it is not possible to send the message within that time, an onSendError event will be raised. A time-to-live of 0 indicates that the message should be sent immediately or fail if it's not possible. The maximum and a default value of time-to-live is 86400 seconds (1 day)."
}, },
"data": { "data": {
"type": "object", "type": "object",
......
...@@ -6,7 +6,7 @@ function createMessage() { ...@@ -6,7 +6,7 @@ function createMessage() {
return { return {
messageId: "message-id", messageId: "message-id",
destinationId: "destination-id", destinationId: "destination-id",
timeToLive: 2419200, timeToLive: 86400,
data: { data: {
"key1": "value1", "key1": "value1",
"key2": "value" "key2": "value"
...@@ -61,7 +61,7 @@ chrome.test.runTests([ ...@@ -61,7 +61,7 @@ chrome.test.runTests([
expectFailureWhen(function(message) { message.timeToLive = -1; }); expectFailureWhen(function(message) { message.timeToLive = -1; });
}, },
function failureWhenTtlIsTooLarge() { function failureWhenTtlIsTooLarge() {
expectFailureWhen(function(message) { message.timeToLive = 24192001; }); expectFailureWhen(function(message) { message.timeToLive = 86401; });
}, },
function failureWhenMessageIdMissing() { function failureWhenMessageIdMissing() {
expectFailureWhen(function(message) { delete message.messageId; }); expectFailureWhen(function(message) { delete message.messageId; });
......
...@@ -14,6 +14,9 @@ GCMClient::ChromeBuildInfo::ChromeBuildInfo() ...@@ -14,6 +14,9 @@ GCMClient::ChromeBuildInfo::ChromeBuildInfo()
GCMClient::ChromeBuildInfo::~ChromeBuildInfo() { GCMClient::ChromeBuildInfo::~ChromeBuildInfo() {
} }
// static
const int GCMClient::OutgoingMessage::kMaximumTTL = 24 * 60 * 60; // 1 day.
GCMClient::OutgoingMessage::OutgoingMessage() GCMClient::OutgoingMessage::OutgoingMessage()
: time_to_live(kMaximumTTL) { : time_to_live(kMaximumTTL) {
} }
......
...@@ -99,7 +99,7 @@ class GCMClient { ...@@ -99,7 +99,7 @@ class GCMClient {
int time_to_live; int time_to_live;
MessageData data; MessageData data;
static const int kMaximumTTL = 4 * 7 * 24 * 60 * 60; // 4 weeks. static const int kMaximumTTL;
}; };
// Message being received from the other party. // Message being received from the other party.
......
...@@ -46,7 +46,7 @@ const char kLoginSettingDefaultName[] = "new_vc"; ...@@ -46,7 +46,7 @@ const char kLoginSettingDefaultName[] = "new_vc";
const char kLoginSettingDefaultValue[] = "1"; const char kLoginSettingDefaultValue[] = "1";
// Maximum amount of time to save an unsent outgoing message for. // Maximum amount of time to save an unsent outgoing message for.
const int kMaxTTLSeconds = 4 * 7 * 24 * 60 * 60; // 4 weeks. const int kMaxTTLSeconds = 24 * 60 * 60; // 1 day.
} // namespace } // namespace
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment