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/test/data/extensions/api_test/gcm/functions/send/send.js

Issue 141433030: [GCM] Updating the list of restricted keys for GCM API messages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing code reviews from jianli@ and kalman@, fixing a typo in error messages" Created 6 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 unified diff | Download patch
« no previous file with comments | « chrome/test/data/extensions/api_test/gcm/events/on_send_error.js ('k') | 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 function createMessage() { 5 function createMessage() {
6 return { 6 return {
7 messageId: "message-id", 7 messageId: "message-id",
8 destinationId: "destination-id", 8 destinationId: "destination-id",
9 timeToLive: 2419200, 9 timeToLive: 2419200,
10 data: { 10 data: {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 }); 90 });
91 }, 91 },
92 function failureWhenDataKeyIsGoogDot() { 92 function failureWhenDataKeyIsGoogDot() {
93 expectFailureWhen(function(message) { message.data["goog."] = "value"; }); 93 expectFailureWhen(function(message) { message.data["goog."] = "value"; });
94 }, 94 },
95 function failureWhenDataKeyIsGoogDotPrefixed() { 95 function failureWhenDataKeyIsGoogDotPrefixed() {
96 expectFailureWhen(function(message) { 96 expectFailureWhen(function(message) {
97 message.data["goog.something"] = "value"; 97 message.data["goog.something"] = "value";
98 }); 98 });
99 }, 99 },
100 function failureWhenDataKeyIsGoogDotMixedCasedPrefixed() {
101 expectFailureWhen(function(message) {
102 message.data["GoOg.something"] = "value";
103 });
104 },
100 function successWhenDataKeyHasGoogleInIt() { 105 function successWhenDataKeyHasGoogleInIt() {
101 expectSuccessWhen(function(message) { 106 expectSuccessWhen(function(message) {
102 message.data["somthing.google"] = "value"; 107 message.data["somthing.google"] = "value";
103 }); 108 });
104 }, 109 },
105 function failureWhenDataKeyIsGoogle() { 110 function failureWhenDataKeyIsGoogle() {
106 expectFailureWhen(function(message) { 111 expectFailureWhen(function(message) {
107 message.data["google"] = "value"; 112 message.data["google"] = "value";
108 }); 113 });
109 }, 114 },
115 function failureWhenDataKeyIsMixedCasedGoogle() {
116 expectFailureWhen(function(message) {
117 message.data["GoOgLe"] = "value";
118 });
119 },
110 function failureWhenDataKeyIsGooglePrefixed() { 120 function failureWhenDataKeyIsGooglePrefixed() {
111 expectFailureWhen(function(message) { 121 expectFailureWhen(function(message) {
112 message.data["googleSomething"] = "value"; 122 message.data["googleSomething"] = "value";
113 }); 123 });
114 }, 124 },
125 function failureWhenDataKeyIsCollapeKey() {
126 expectFailureWhen(function(message) {
127 message.data["collapse_key"] = "value";
128 });
129 },
115 function failureWhenMessageIsTooLarge() { 130 function failureWhenMessageIsTooLarge() {
116 expectFailureWhen(function(message) { 131 expectFailureWhen(function(message) {
117 function generateString(base, len) { 132 function generateString(base, len) {
118 // Generates a string of size |len| by concatenating |base| multiple 133 // Generates a string of size |len| by concatenating |base| multiple
119 // times and trimming to |len|. 134 // times and trimming to |len|.
120 while (base.length < len) base += base; 135 while (base.length < len) base += base;
121 return base.substring(0, len); 136 return base.substring(0, len);
122 } 137 }
123 138
124 var source = "abcdefghijklmnopqrstuvwxyz"; 139 var source = "abcdefghijklmnopqrstuvwxyz";
125 // Creates 8 * (256 + 256) == 4096 bytes of message data which together 140 // Creates 8 * (256 + 256) == 4096 bytes of message data which together
126 // with data put in by default is more than allowed max. 141 // with data put in by default is more than allowed max.
127 var entries = 8; 142 var entries = 8;
128 while (entries > 0) { 143 while (entries > 0) {
129 var s = generateString(source + entries, 256); 144 var s = generateString(source + entries, 256);
130 message.data[s] = s; 145 message.data[s] = s;
131 --entries; 146 --entries;
132 } 147 }
133 }); 148 });
134 } 149 }
135 ]); 150 ]);
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/gcm/events/on_send_error.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698