Chromium Code Reviews| Index: chrome/test/data/extensions/api_test/notification_provider/basic_usage/background.js |
| diff --git a/chrome/test/data/extensions/api_test/notification_provider/basic_usage/background.js b/chrome/test/data/extensions/api_test/notification_provider/basic_usage/background.js |
| index 58e524266a1ae0fcb1c4d545cb68bc3ca2d14ce1..4b4e7cbf7a7dbc25076410ebdb4caf5550b32d8c 100644 |
| --- a/chrome/test/data/extensions/api_test/notification_provider/basic_usage/background.js |
| +++ b/chrome/test/data/extensions/api_test/notification_provider/basic_usage/background.js |
| @@ -97,6 +97,8 @@ function failTest(testName) { |
| chrome.test.fail(testName); |
| }; |
| +function listenForShowSettings() {} |
| + |
| function testFunctions() { |
| var myId = chrome.runtime.id; |
| var id1 = "id1"; |
| @@ -108,16 +110,20 @@ function testFunctions() { |
| message: "This is the message." |
| }; |
| + // Add listener to onShowSettings to show that this extension has advanced |
| + // settings. |
| + chrome.notifications.onShowSettings.addListener(listenForShowSettings); |
| + |
| // Create a notification, so there will be one existing notification |
| createNotification(id1, content) |
|
dewittj
2014/08/12 18:21:05
it would be better if this test also verified that
liyanhou
2014/08/13 21:06:26
Done.
|
| .catch(function() { failTest("notifications.create"); }) |
| // Notify the sender that a notificaion was clicked. |
| .then(function() { return notifyOnClicked(myId, returnId); }) |
| - .catch(function() { failTest("NotifyOnClicked1"); }) |
| + .catch(function() { failTest("NotifyOnClicked"); }) |
| // Try to notify that an non-existent notification was clicked. |
| .then(function() { return notifyOnClicked(myId, "doesNotExist"); }) |
| // Fail if it returns true. |
| - .then(function() { failTest("NotifyOnClicked2"); }) |
| + .then(function() { failTest("NotifyOnClicked"); }) |
| // Notify the sender that a notificaion button was clicked. |
| .catch(function() { return notifyOnButtonClicked(myId, returnId, 0); }) |
| .catch(function() { failTest("NotifyOnButtonClicked"); }) |
| @@ -130,12 +136,17 @@ function testFunctions() { |
| // Notify that the original notification was cleared. |
| .catch(function() { return notifyOnCleared(myId, returnId); }) |
| .catch(function() { failTest("NotifyOnCleared"); }) |
| + // Notify the sender that the permission level is changed by the user |
| .then(function () { return notifyOnPermissionLevelChanged(myId, |
| "granted"); }) |
| .catch(function() { failTest("NotifyOnPermissionLevelChanged"); }) |
| .then(function () { return notifyOnShowSettings(myId); }) |
| .catch(function() { failTest("NotifyOnShowSettings"); }) |
| - .then(function() { chrome.test.succeed(); }); |
| + // Try to notify a non existent sender that a user checked its settings |
| + .then(function () { return notifyOnShowSettings("DoesNotExist"); }) |
| + // Fail if it returns true |
| + .then(function() { failTest("NotifyOnShowSettings"); }) |
| + .catch(function() { chrome.test.succeed(); }) |
| }; |
| chrome.test.runTests([ testFunctions ]); |