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

Side by Side Diff: chrome/test/data/extensions/api_test/notification/api/by_user/background.js

Issue 12313115: Take notification API out of experimental. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflict. Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 const notification = chrome.experimental.notification;
6 var theOnlyTestDone = null;
7
8 var notificationData = {
9 templateType: "basic",
10 iconUrl: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAA" +
11 "CNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHw" +
12 "AAAABJRU5ErkJggg==",
13 title: "Attention!",
14 message: "Check out Cirque du Soleil"
15 };
16
17 var results = {
18 FOO: false,
19 BAR: true,
20 BAT: false,
21 BIFF: false,
22 BLAT: true,
23 BLOT: true
24 };
25
26 function createCallback(id) { }
27
28 var onClosedHooks = {
29 BIFF: function() {
30 notification.create("BLAT", notificationData, createCallback);
31 notification.create("BLOT", notificationData, createCallback);
32 },
33 };
34
35 function onClosedListener(id, by_user) {
36 if (results[id] !== by_user) {
37 chrome.test.notifyFail("Notification " + id +
38 " closed with bad by_user param ( "+ by_user +" )");
39 return;
40 }
41 chrome.test.notifyPass();
42 delete results[id];
43
44 if (typeof onClosedHooks[id] === "function")
45 onClosedHooks[id]();
46
47 if (Object.keys(results).length === 0)
48 theOnlyTestDone();
49 }
50
51 notification.onClosed.addListener(onClosedListener);
52
53 function theOnlyTest() {
54 theOnlyTestDone = chrome.test.callbackAdded();
55
56 notification.create("FOO", notificationData, createCallback);
57 notification.create("BAR", notificationData, createCallback);
58 notification.create("BAT", notificationData, createCallback);
59 notification.create("BIFF", notificationData, createCallback);
60 }
61
62 chrome.test.runTests([ theOnlyTest ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698