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

Unified Diff: chrome/test/data/extensions/api_test/instance_id/delete_token/delete_token.js

Issue 1137463003: Support getting and deleting token for Instance ID. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch to land 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/instance_id/delete_token/delete_token.js
diff --git a/chrome/test/data/extensions/api_test/instance_id/delete_token/delete_token.js b/chrome/test/data/extensions/api_test/instance_id/delete_token/delete_token.js
index cd3db4acaacdbe3d91ad7315187328e8bb5f7599..dbf17192a257f974c5449fc4c8a9ad566e8370e7 100644
--- a/chrome/test/data/extensions/api_test/instance_id/delete_token/delete_token.js
+++ b/chrome/test/data/extensions/api_test/instance_id/delete_token/delete_token.js
@@ -110,6 +110,43 @@ function deleteTokenAfterGetToken() {
);
}
+var oldToken;
+function getTokenDeleteTokeAndGetToken() {
+ chrome.instanceID.getToken(
+ {"authorizedEntity": "1", "scope": "GCM"},
+ function(token) {
+ if (chrome.runtime.lastError || !token) {
+ chrome.test.fail(
+ "chrome.runtime.lastError was set or token was empty.");
+ return;
+ }
+ oldToken = token;
+ chrome.instanceID.deleteToken(
+ {"authorizedEntity": "1", "scope": "GCM"},
+ function() {
+ if (chrome.runtime.lastError) {
+ chrome.test.fail("chrome.runtime.lastError: " +
+ chrome.runtime.lastError.message);
+ return;
+ }
+
+ chrome.instanceID.getToken(
+ {"authorizedEntity": "1", "scope": "GCM"},
+ function(token) {
+ if (!token || token == oldToken) {
+ chrome.test.fail(
+ "Different token should be returned after deleteToken.");
+ return;
+ }
+ chrome.test.succeed();
+ }
+ );
+ }
+ );
+ }
+ );
+}
+
chrome.test.runTests([
deleteTokenWithoutParameters,
deleteTokenWithoutCallback,
@@ -117,8 +154,7 @@ chrome.test.runTests([
deleteTokenWithInvalidAuthorizedEntity,
deleteTokenWithoutScope,
deleteTokenWithInvalidScope,
- // TODO(jianli): To be enabled when deleteToken is implemented.
- //deleteTokenBeforeGetToken,
- //deleteTokenAfterGetToken,
- //getTokenDeleteTokeAndGetToken,
+ deleteTokenBeforeGetToken,
+ deleteTokenAfterGetToken,
+ getTokenDeleteTokeAndGetToken,
]);

Powered by Google App Engine
This is Rietveld 408576698