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) {
service()->last_sent_message();
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) {
......
......@@ -79,9 +79,9 @@
"timeToLive": {
"type": "integer",
"minimum": 0,
"maximum": 2419200,
"maximum": 86400,
"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": {
"type": "object",
......
......@@ -6,7 +6,7 @@ function createMessage() {
return {
messageId: "message-id",
destinationId: "destination-id",
timeToLive: 2419200,
timeToLive: 86400,
data: {
"key1": "value1",
"key2": "value"
......@@ -61,7 +61,7 @@ chrome.test.runTests([
expectFailureWhen(function(message) { message.timeToLive = -1; });
},
function failureWhenTtlIsTooLarge() {
expectFailureWhen(function(message) { message.timeToLive = 24192001; });
expectFailureWhen(function(message) { message.timeToLive = 86401; });
},
function failureWhenMessageIdMissing() {
expectFailureWhen(function(message) { delete message.messageId; });
......
......@@ -14,6 +14,9 @@ GCMClient::ChromeBuildInfo::ChromeBuildInfo()
GCMClient::ChromeBuildInfo::~ChromeBuildInfo() {
}
// static
const int GCMClient::OutgoingMessage::kMaximumTTL = 24 * 60 * 60; // 1 day.
GCMClient::OutgoingMessage::OutgoingMessage()
: time_to_live(kMaximumTTL) {
}
......
......@@ -99,7 +99,7 @@ class GCMClient {
int time_to_live;
MessageData data;
static const int kMaximumTTL = 4 * 7 * 24 * 60 * 60; // 4 weeks.
static const int kMaximumTTL;
};
// Message being received from the other party.
......
......@@ -46,7 +46,7 @@ const char kLoginSettingDefaultName[] = "new_vc";
const char kLoginSettingDefaultValue[] = "1";
// 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
......
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