OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 var testEvents = function() { | 4 |
5 var idString = "id1"; | |
6 | |
7 function testOnCreated() { | |
8 | |
dewittj
2014/08/13 18:30:17
nit: no blank line
| |
9 var content = { | |
10 type: "basic", | |
11 iconUrl: "icon.png", | |
12 title: "Title", | |
13 message: "This is the message." | |
14 }; | |
15 | |
16 var createCallback = function (id) {} | |
17 chrome.notifications.create(idString, content, createCallback); | |
5 | 18 |
6 chrome.notificationProvider.onCreated.addListener(function(senderId, | 19 chrome.notificationProvider.onCreated.addListener(function(senderId, |
7 notificationId, | 20 notificationId, |
8 options) { | 21 options) { |
22 var str = notificationId.split("-"); | |
23 chrome.test.assertEq(idString, str[1]); | |
24 chrome.test.assertEq(options.title, content.title); | |
25 chrome.test.assertEq(options.message, content.message); | |
9 chrome.test.succeed(); | 26 chrome.test.succeed(); |
10 }); | 27 }); |
28 chrome.test.succeed(); | |
29 }; | |
11 | 30 |
31 function testOnUpdated() { | |
12 chrome.notificationProvider.onUpdated.addListener(function(senderId, | 32 chrome.notificationProvider.onUpdated.addListener(function(senderId, |
13 notificationId, | 33 notificationId, |
14 options) { | 34 options) { |
15 chrome.test.succeed(); | 35 chrome.test.succeed(); |
16 }); | 36 }); |
37 chrome.test.succeed(); | |
38 } | |
17 | 39 |
40 function testOnCleared() { | |
18 chrome.notificationProvider.onCleared.addListener(function(senderId, | 41 chrome.notificationProvider.onCleared.addListener(function(senderId, |
19 notificationId) { | 42 notificationId) { |
20 chrome.test.succeed(); | 43 chrome.test.succeed(); |
21 }); | 44 }); |
22 }; | 45 chrome.test.succeed(); |
46 } | |
23 | 47 |
24 chrome.test.runTests([ testEvents ]); | 48 chrome.test.runTests([ testOnCreated, testOnUpdated, testOnCleared ]); |
OLD | NEW |