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

Unified Diff: chrome/test/data/extensions/api_test/notifications/api/by_user/background.js

Issue 291193009: Reland: Allow high-res bitmaps to be passed in from notifications API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test post-rebase. Created 6 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/notifications/api/by_user/background.js
diff --git a/chrome/test/data/extensions/api_test/notifications/api/by_user/background.js b/chrome/test/data/extensions/api_test/notifications/api/by_user/background.js
index bb59d3dc0a03290462029d15d4e2e39ce3807f3c..3d765de1e6cc82b0d828620bff249e228dd88591 100644
--- a/chrome/test/data/extensions/api_test/notifications/api/by_user/background.js
+++ b/chrome/test/data/extensions/api_test/notifications/api/by_user/background.js
@@ -25,10 +25,25 @@ var results = {
function createCallback(id) { }
+function notifyPass() { chrome.test.notifyPass(); }
+
var onClosedHooks = {
+ FOO: notifyPass,
+ BAR: notifyPass,
BIFF: function() {
- notifications.create("BLAT", notificationData, createCallback);
- notifications.create("BLOT", notificationData, createCallback);
+ notifications.create("BLAT", notificationData, function () {
+ if (chrome.runtime.lastError) {
+ chrome.test.notifyFail(lastError.message);
+ return;
+ }
+ notifications.create("BLOT", notificationData, function () {
+ if (chrome.runtime.lastError) {
+ chrome.test.notifyFail(lastError.message);
+ return;
+ }
+ chrome.test.notifyPass("Created the new notifications.");
+ });
+ });
},
};
@@ -38,19 +53,25 @@ function onClosedListener(id, by_user) {
" closed with bad by_user param ( "+ by_user +" )");
return;
}
- chrome.test.notifyPass();
delete results[id];
if (typeof onClosedHooks[id] === "function")
onClosedHooks[id]();
- if (Object.keys(results).length === 0)
+ if (Object.keys(results).length === 0) {
+ chrome.test.notifyPass("Done!");
theOnlyTestDone();
+ }
}
notifications.onClosed.addListener(onClosedListener);
function theOnlyTest() {
+ // This test coordinates with the browser test. First, 4 notifications are
+ // created. Then 2 are manually cancelled in C++. Then clearAll is called
+ // with false |by_user|. Then once the BIFF notification is cleared, we
+ // create two more notifications in JS, and C++ calls the clearAll with true
+ // |by_user|.
theOnlyTestDone = chrome.test.callbackAdded();
notifications.create("FOO", notificationData, createCallback);

Powered by Google App Engine
This is Rietveld 408576698