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.
5 const notifications
= chrome
.notifications
;
9 var testCSP = function() {
10 var onCreateCallback = function(id
) {
11 if (chrome
.runtime
.lastError
) {
12 chrome
.test
.succeed();
20 iconUrl
: "http://google.com/clearly-a-security-problem.png",
22 message
: "Check out Cirque du Soleil"
24 notifications
.create(idString
, options
, onCreateCallback
);
27 function testDataURL() {
28 chrome
.runtime
.lastError
= undefined;
29 var onCreateCallback = function(id
) {
30 if (chrome
.runtime
.lastError
) {
34 chrome
.test
.succeed();
38 iconUrl
: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAA" +
39 "CNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHw" +
42 message
: "Check out Cirque du Soleil"
44 notifications
.create(idString
, options
, onCreateCallback
);
47 function testCSPUpdateIconURL() {
48 var onUpdateCallback = function(id
) {
49 if (chrome
.runtime
.lastError
) {
50 chrome
.test
.succeed();
55 var onCreateCallback = function(id
) {
56 if (chrome
.runtime
.lastError
) {
62 iconUrl
: "http://www.google.com/favicon.ico",
64 message
: "Check out Cirque du Soleil"
66 notifications
.update(idString
, options2
, onUpdateCallback
);
70 iconUrl
: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAA" +
71 "CNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHw" +
74 message
: "Check out Cirque du Soleil"
76 notifications
.create(idString
, options
, onCreateCallback
);
79 function testCSPUpdateImageURL() {
80 var onUpdateCallback = function(id
) {
81 if (chrome
.runtime
.lastError
) {
82 chrome
.test
.succeed();
87 var onCreateCallback = function(id
) {
88 if (chrome
.runtime
.lastError
) {
94 iconUrl
: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAA" +
95 "CNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHw" +
97 imageUrl
: "http://www.google.com/favicon.ico",
99 message
: "Check out Cirque du Soleil"
101 notifications
.update(idString
, options2
, onUpdateCallback
);
105 iconUrl
: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAA" +
106 "CNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHw" +
107 "AAAABJRU5ErkJggg==",
108 imageUrl
: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAA" +
109 "CNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHw" +
110 "AAAABJRU5ErkJggg==",
112 message
: "Check out Cirque du Soleil"
114 notifications
.create(idString
, options
, onCreateCallback
);
117 function testCSPUpdateButtonIconURL() {
118 var onUpdateCallback = function(id
) {
119 if (chrome
.runtime
.lastError
) {
120 chrome
.test
.succeed();
125 var onCreateCallback = function(id
) {
126 if (chrome
.runtime
.lastError
) {
132 iconUrl
: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAA" +
133 "CNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHw" +
134 "AAAABJRU5ErkJggg==",
138 iconUrl
: "http://www.google.com/favicon.ico"
140 message
: "Check out Cirque du Soleil"
142 notifications
.update(idString
, options2
, onUpdateCallback
);
146 iconUrl
: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAA" +
147 "CNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHw" +
148 "AAAABJRU5ErkJggg==",
152 iconUrl
: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAA" +
153 "CNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHw" +
156 message
: "Check out Cirque du Soleil"
158 notifications
.create(idString
, options
, onCreateCallback
);
160 chrome
.test
.runTests([
163 testCSPUpdateIconURL
,
164 testCSPUpdateImageURL
,
165 testCSPUpdateButtonIconURL
]);