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

Unified Diff: trunk/src/chrome/test/data/extensions/api_test/notification_provider/basic_usage/background.js

Issue 447543003: Revert 287692 "Add a browser test for functions in notification ..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: trunk/src/chrome/test/data/extensions/api_test/notification_provider/basic_usage/background.js
===================================================================
--- trunk/src/chrome/test/data/extensions/api_test/notification_provider/basic_usage/background.js (revision 287721)
+++ trunk/src/chrome/test/data/extensions/api_test/notification_provider/basic_usage/background.js (working copy)
@@ -1,112 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-const notificationProvider = chrome.notificationProvider;
-
-function notifyOnCleared(senderId, notificationId) {
- return new Promise(function (resolve, reject) {
- notificationProvider.notifyOnCleared(senderId,
- notificationId,
- function (wasCleared) {
- if (chrome.runtime.lastError || !wasCleared) {
- reject(new Error("Unable to send onClear message"));
- return;
- }
- resolve(wasCleared);
- return;
- });
- });
-};
-
-function notifyOnClicked(senderId, notificationId) {
- return new Promise(function (resolve, reject) {
- notificationProvider.notifyOnClicked(senderId,
- notificationId,
- function (matchExists) {
- if (chrome.runtime.lastError || !matchExists) {
- reject(new Error("Unable to send onClick message"));
- return;
- }
- resolve(matchExists);
- return;
- });
- });
-};
-
-function notifyOnButtonClicked(senderId, notificationId, buttonIndex) {
- return new Promise(function (resolve, reject) {
- notificationProvider.notifyOnButtonClicked(senderId,
- notificationId,
- buttonIndex,
- function (matchExists) {
- if (chrome.runtime.lastError || !matchExists) {
- reject(new Error("Unable to send onButtonClick message"));
- return;
- }
- resolve(matchExists);
- return;
- });
- });
-};
-
-function notifyOnPermissionLevelChanged(senderId, permissionLevel) {
- return new Promise(function (resolve, reject) {
- notificationProvider.notifyOnPermissionLevelChanged(
- senderId,
- permissionLevel,
- function (notifierExists) {
- if (chrome.runtime.lastError || !notifierExists) {
- reject(new Error("Unable to send onPermissionLevelChanged message"));
- return;
- }
- resolve(notifierExists);
- return;
- });
- });
-};
-
-function notifyOnShowSettings(senderId) {
- return new Promise(function (resolve, reject) {
- notificationProvider.notifyOnShowSettings(senderId,
- function (notifierExists) {
- if (chrome.runtime.lastError || !notifierExists) {
- reject(new Error("Unable to send onShowSettings message"));
- return;
- }
- resolve(notifierExists);
- return;
- });
- });
-};
-
-function failTest(testName) {
- chrome.test.fail(testName);
-};
-
-function testFunctions() {
- var testName = "testFunctions";
- var notifierId;
- var notId;
- notificationProvider.onCreated.addListener(function(senderId,
- notificationId,
- content) {
- notifierId = senderId;
- notId = notificationId;
-
- notifyOnClicked(notifierId, notId)
- .catch(function() { failTest("NotifyOnClickedFailed"); })
- .then(function() { return notifyOnButtonClicked(notifierId, notId, 0); })
- .catch(function() { failTest("NotifyOnButtonClickedFailed"); })
- .then(function () { return notifyOnCleared(notifierId, notId); })
- .catch(function() { failTest("NotifyOnClearedFailed"); })
- .then(function () { return notifyOnPermissionLevelChanged(notifierId,
- "granted"); })
- .catch(function() { failTest("NotifyOnPermissionLevelChangedFailed"); })
- .then(function () { return notifyOnShowSettings(notifierId); })
- .catch(function() { failTest("NotifyOnShowSettingsFailed"); })
- .then(function() { chrome.test.succeed(testName); });
- });
-};
-
-chrome.test.runTests([ testFunctions ]);

Powered by Google App Engine
This is Rietveld 408576698