Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / test / data / extensions / api_test / notifications / api / permission / background.js
bloba5bddec5ad9a51f49d1a85331c340e88e8492347
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");
19     return;
20   }
22   if (permissionLevel == currentPermissionLevel) {
23     chrome.test.notifyFail(
24         "Same permission level " + permissionLevel + " received");
25     return;
26   }
28   currentPermissionLevel = permissionLevel;
29   chrome.test.notifyPass();
32 getPermissionLevel();
33 chrome.notifications.onPermissionLevelChanged.addListener(
34     onPermissionLevelChangedListener);