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

Side by Side Diff: chrome/test/data/extensions/api_test/events/background.js

Issue 8758008: Move another block of extension tests to manifest_version 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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.
4
5 chrome.test.runTests([
6 // Tests that attaching and detaching to an event for which we don't have
7 // permission acts as expected (e.g. we don't DCHECK!).
8 function attachAndDetachNoPermisssions() {
9 function dummy() {};
10 try {
11 chrome.tabs.onUpdated.addListener(dummy);
12 chrome.test.fail();
13 } catch (e) {
14 chrome.test.assertTrue(
15 e.message.search("You do not have permission") >= 0,
16 e.message);
17 }
18 chrome.test.assertFalse(chrome.tabs.onUpdated.hasListeners());
19 chrome.tabs.onUpdated.removeListener(dummy); // browser should not DCHECK
20 chrome.test.succeed();
21 },
22
23 // Tests that attaching a named event twice will fail.
24 function doubleAttach() {
25 function dummy() {};
26 var onClicked = new chrome.Event("browserAction.onClicked");
27 var onClicked2 = new chrome.Event("browserAction.onClicked");
28 onClicked.addListener(dummy);
29 chrome.test.assertTrue(onClicked.hasListeners());
30 try {
31 onClicked2.addListener(dummy);
32 chrome.test.fail();
33 } catch (e) {
34 chrome.test.assertTrue(
35 e.message.search("already attached") >= 0,
36 e.message);
37 }
38 chrome.test.assertFalse(onClicked2.hasListeners());
39 onClicked2.removeListener(dummy);
40
41 onClicked.removeListener(dummy);
42 chrome.test.assertFalse(onClicked.hasListeners());
43 chrome.test.succeed();
44 },
45
46 // Tests that 2 pages attaching to the same event does not trigger a DCHECK.
47 function twoPageAttach() {
48 // Test harness should already have opened tab.html, which registers this
49 // listener.
50 chrome.browserAction.onClicked.addListener(function() {});
51
52 // Test continues in twoPageAttach.html.
53 window.open("twoPageAttach.html");
54 },
55 ]);
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/events/background.html ('k') | chrome/test/data/extensions/api_test/events/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698