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; |
fgorski
2015/05/13 18:32:38
put this inside of the test.
jianli
2015/05/13 22:42:55
I can't do this because oldToken are referred from
|
+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, |
]); |