1 // Copyright 2013 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 var currentPermissionLevel = "";
7 function onGetPermissionLevel(permissionLevel) {
8 currentPermissionLevel = permissionLevel;
11 function getPermissionLevel() {
12 chrome.notifications.getPermissionLevel(onGetPermissionLevel);
15 function onPermissionLevelChangedListener(permissionLevel) {
16 if (permissionLevel != "denied" && permissionLevel != "granted") {
17 chrome.test.notifyFail(
18 "Unexpected permission level " + permissionLevel + " received");
22 if (permissionLevel == currentPermissionLevel) {
23 chrome.test.notifyFail(
24 "Same permission level " + permissionLevel + " received");
28 currentPermissionLevel = permissionLevel;
29 chrome.test.notifyPass();
33 chrome.notifications.onPermissionLevelChanged.addListener(
34 onPermissionLevelChangedListener);