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, |
]); |